-
-
Notifications
You must be signed in to change notification settings - Fork 405
Propose moving the built-in built-ins' public import path #1137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2fad344
Move built in built-ins
NullVoxPopuli b1931b1
Update 0000-moving-the-reactive-collections.md
NullVoxPopuli 5aeba09
Rename 0000-moving-the-reactive-collections.md to 1137-moving-the-rea…
NullVoxPopuli 183368e
Update text/1137-moving-the-reactive-collections.md
NullVoxPopuli ac18e1f
Update text/1137-moving-the-reactive-collections.md
NullVoxPopuli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| --- | ||
| stage: accepted | ||
| start-date: 2025-08-16T00:00:00.000Z | ||
| release-date: # In format YYYY-MM-DDT00:00:00.000Z | ||
| release-versions: | ||
| teams: | ||
| - framework | ||
| prs: | ||
| accepted: https://github.com/emberjs/rfcs/pull/1137 | ||
| project-link: | ||
| suite: | ||
| --- | ||
|
|
||
| # Move tracked collections to `@ember/reactive/collections` | ||
|
|
||
| ## Summary | ||
|
|
||
| This RFC proposes moving the tracked collections (`trackedArray`, `trackedSet`, `trackedMap`, `trackedWeakSet`, `trackedWeakMap`, and `trackedObject`) from the main `@ember/reactive` package to a subpath import at `@ember/reactive/collections`. | ||
|
|
||
| While it's true that dead-code-elimination would prevent shipping code users don't use, this organization may better communicate what is a core "reactive" thing, vs what is a helpful datastructure. | ||
|
|
||
| ## Motivation | ||
|
|
||
| RFC 1068 introduced tracked collections into the `@ember/reactive` package, but placing them in the main export surface alongside core primitives like `tracked`, `cached`, `cell`, and `resource` may not conflate importance of the collections. | ||
|
|
||
| > [!NOTE] | ||
| > At the time of writing of this RFC, `tracked`, `cached`, `cell`, and `resource` RFCs have not been accepted for inclusion in `@ember/reactive` | ||
|
|
||
| This is somewhat motivated by actual usage out in the ecosystem of tracked-built-ins: | ||
|
|
||
| here are results from github.com searches for the `tracked-built-ins` equivelents: | ||
| - "new TrackedObject(" - [888 Results](https://github.com/search?q=%22new+TrackedObject%28%22&type=code) | ||
| - "new TrackedArray(" - [468 Results](https://github.com/search?q=%22new+TrackedArray(%22&type=code) | ||
| - "new TrackedSet(" - [129 Results](https://github.com/search?q=%22new+TrackedSet(%22&type=code) | ||
| - "new TrackedWeakSet(" - [29 Results](https://github.com/search?q=%22new+TrackedWeakSet(%22&type=code) | ||
| - "new TrackedWeakMap(" - [32 Results](https://github.com/search?q=%22new+TrackedWeakMap(%22&type=code) | ||
|
|
||
| ## Detailed design | ||
|
|
||
| Instead of importing tracked collections from the main `@ember/reactive` package: | ||
|
|
||
| ```js | ||
| // Current (RFC 1068) | ||
| import { | ||
| trackedObject, trackedArray, | ||
| trackedMap, trackedWeakMap, | ||
| trackedSet, trackedWeakSet | ||
| } from '@ember/reactive'; | ||
| ``` | ||
|
|
||
| Users would import them from the `/collections` subpath: | ||
|
|
||
| ```js | ||
| // Proposed | ||
| import { | ||
| trackedObject, trackedArray, | ||
| trackedMap, trackedWeakMap, | ||
| trackedSet, trackedWeakSet | ||
| } from '@ember/reactive/collections'; | ||
| ``` | ||
|
|
||
| This is non-breaking, because `@ember/reactive` hasn't been released yet. | ||
|
|
||
| ## How we teach this | ||
|
|
||
| Same as in RFC #1068, but with updated import paths. | ||
|
|
||
| ## Drawbacks | ||
|
|
||
| Developers need to remember that collections are imported from `@ember/reactive/collections` rather than the main `@ember/reactive` package, adding one more import path to the mental model. | ||
|
|
||
| This maintains the status quo tho as folks are already used to importing from `tracked-bulit-ins` for these collections. | ||
NullVoxPopuli marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Alternatives | ||
|
|
||
| - Keep collections in main `@ember/reactive` module | ||
|
|
||
| ## Unresolved questions | ||
| n/a | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.