From 2fad3441d0084b51fb5f26d5ddcaa3a1567be89a Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Sat, 16 Aug 2025 19:03:28 -0400 Subject: [PATCH 1/5] Move built in built-ins --- text/0000-moving-the-reactive-collections.md | 79 ++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 text/0000-moving-the-reactive-collections.md diff --git a/text/0000-moving-the-reactive-collections.md b/text/0000-moving-the-reactive-collections.md new file mode 100644 index 0000000000..dcee9d3420 --- /dev/null +++ b/text/0000-moving-the-reactive-collections.md @@ -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: # Fill this in with the URL for the Proposal RFC PR +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. + +## Alternatives + +- Keep collections in main `@ember/reactive` module + +## Unresolved questions +n/a \ No newline at end of file From b1931b1403af71d4c2da1aab6b27b7c8741e2655 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Sat, 16 Aug 2025 19:29:29 -0400 Subject: [PATCH 2/5] Update 0000-moving-the-reactive-collections.md --- text/0000-moving-the-reactive-collections.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/text/0000-moving-the-reactive-collections.md b/text/0000-moving-the-reactive-collections.md index dcee9d3420..4d2ad39d08 100644 --- a/text/0000-moving-the-reactive-collections.md +++ b/text/0000-moving-the-reactive-collections.md @@ -6,7 +6,7 @@ release-versions: teams: - framework prs: - accepted: # Fill this in with the URL for the Proposal RFC PR + accepted: https://github.com/emberjs/rfcs/pull/1137 project-link: suite: --- @@ -76,4 +76,4 @@ This maintains the status quo tho as folks are already used to importing from `t - Keep collections in main `@ember/reactive` module ## Unresolved questions -n/a \ No newline at end of file +n/a From 5aeba093858c967f9dbb67c6e570730a2c608357 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Sat, 16 Aug 2025 19:29:41 -0400 Subject: [PATCH 3/5] Rename 0000-moving-the-reactive-collections.md to 1137-moving-the-reactive-collections.md --- ...ive-collections.md => 1137-moving-the-reactive-collections.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename text/{0000-moving-the-reactive-collections.md => 1137-moving-the-reactive-collections.md} (100%) diff --git a/text/0000-moving-the-reactive-collections.md b/text/1137-moving-the-reactive-collections.md similarity index 100% rename from text/0000-moving-the-reactive-collections.md rename to text/1137-moving-the-reactive-collections.md From 183368e092e4f14fc5cd06c5d800c62db1a2d55b Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Tue, 19 Aug 2025 08:21:45 -0400 Subject: [PATCH 4/5] Update text/1137-moving-the-reactive-collections.md Co-authored-by: MrChocolatine <47531779+MrChocolatine@users.noreply.github.com> --- text/1137-moving-the-reactive-collections.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/1137-moving-the-reactive-collections.md b/text/1137-moving-the-reactive-collections.md index 4d2ad39d08..b2c77dfee9 100644 --- a/text/1137-moving-the-reactive-collections.md +++ b/text/1137-moving-the-reactive-collections.md @@ -28,7 +28,7 @@ RFC 1068 introduced tracked collections into the `@ember/reactive` package, but 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: +here are results from github.com searches for the `tracked-built-ins` equivalents: - "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) From ac18e1fb7c6310e2658973fb211162c5ce2775ba Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Tue, 19 Aug 2025 08:21:54 -0400 Subject: [PATCH 5/5] Update text/1137-moving-the-reactive-collections.md Co-authored-by: MrChocolatine <47531779+MrChocolatine@users.noreply.github.com> --- text/1137-moving-the-reactive-collections.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/1137-moving-the-reactive-collections.md b/text/1137-moving-the-reactive-collections.md index b2c77dfee9..1073ab3f10 100644 --- a/text/1137-moving-the-reactive-collections.md +++ b/text/1137-moving-the-reactive-collections.md @@ -69,7 +69,7 @@ Same as in RFC #1068, but with updated import paths. 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. +This maintains the status quo tho as folks are already used to importing from `tracked-built-ins` for these collections. ## Alternatives