You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -248,6 +251,23 @@ For example, other future exports from `@ember/reactive` (in future RFCs), may i
248
251
without the static analysis guarantees of `type=module`, every consumer of `@ember/reactive` would always have all of these exports in their build.
249
252
For some utilities, we can place them under sub-path-exports, such as `@ember/reactive/window`, for window-specific reactive properties, but the exact specifics of each of these can be hashed out in their individual RFCs.
250
253
254
+
#### Why are the collections under `@ember/reactive/collections`?
255
+
256
+
Placing the collections in the main export surface alongside core primitives like `tracked`, `cached`, `cell`, and `resource` may not conflate importance of the collections.
257
+
258
+
> [!NOTE]
259
+
> At the time of writing of this RFC, `tracked`, `cached`, `cell`, and `resource` RFCs have not been accepted for inclusion in `@ember/reactive`
260
+
261
+
This is motivated by actual usage out in the ecosystem of tracked-built-ins:
262
+
263
+
here are results from github.com searches for the `tracked-built-ins` equivalents (excluding ember-owned repos and forks of them):
264
+
- "new TrackedObject(" - [520 Results]([https://github.com/search?q=%22new+TrackedObject%28%22&type=code](https://github.com/search?q=%22new+TrackedObject%28%22+NOT+is%3Afork++NOT+org%3Aemberjs+NOT+org%3Atracked-tools+NOT+org%3Aember-cli+NOT+org%3Aember-migration-utils+NOT+org%3Aember-learn&type=code))
265
+
- "new TrackedArray(" - [312 Results](https://github.com/search?q=%22new+TrackedArray%28%22+NOT+is%3Afork++NOT+org%3Aemberjs+NOT+org%3Atracked-tools+NOT+org%3Aember-cli+NOT+org%3Aember-migration-utils+NOT+org%3Aember-learn+&type=code)
266
+
- "new TrackedSet(" - [74 Results](https://github.com/search?q=%22new+TrackedSet%28%22+NOT+is%3Afork++NOT+org%3Aemberjs+NOT+org%3Atracked-tools+NOT+org%3Aember-cli+NOT+org%3Aember-migration-utils+NOT+org%3Aember-learn+&type=code)
267
+
- "new TrackedWeakSet(" - [5 Results](https://github.com/search?q=%22new+TrackedWeakSet%28%22+NOT+is%3Afork++NOT+org%3Aemberjs+NOT+org%3Atracked-tools+NOT+org%3Aember-cli+NOT+org%3Aember-migration-utils+NOT+org%3Aember-learn+&type=code)
268
+
- "new TrackedWeakMap(" - [4 Results](https://github.com/search?q=%22new+TrackedWeakMap%28%22+NOT+is%3Afork++NOT+org%3Aemberjs+NOT+org%3Atracked-tools+NOT+org%3Aember-cli+NOT+org%3Aember-migration-utils+NOT+org%3Aember-learn+&type=code)
269
+
270
+
Additionally, specifying collections gives us a blessed path for exported other useful datastructures in the future without continually adding to the main export file (even though dead-code-elimination would eliminate what is unused - not importing what may not be used could help local development)
251
271
252
272
### Consumption
253
273
@@ -274,7 +294,7 @@ A utility for creating tracked arrays, copying the original data so that mutatio
274
294
See [MDN for more information](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)
275
295
276
296
```gjs
277
-
import { trackedArray } from '@ember/reactive';
297
+
import { trackedArray } from '@ember/reactive/collections';
278
298
import { on } from '@ember/modifier';
279
299
import { fn } from '@ember/helper';
280
300
@@ -301,7 +321,7 @@ A utility for creating tracked objects, copying the original data so that mutati
301
321
See [MDN for more information](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
302
322
303
323
```gjs
304
-
import { trackedObject } from '@ember/reactive';
324
+
import { trackedObject } from '@ember/reactive/collections';
305
325
import { on } from '@ember/modifier';
306
326
import { fn } from '@ember/helper';
307
327
@@ -328,7 +348,7 @@ A utility for creating tracked maps, copying the original data so that mutations
328
348
See [MDN for more information](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)
329
349
330
350
```gjs
331
-
import { trackedMap } from '@ember/reactive';
351
+
import { trackedMap } from '@ember/reactive/collections';
332
352
import { on } from '@ember/modifier';
333
353
import { fn } from '@ember/helper';
334
354
@@ -356,7 +376,7 @@ A utility for creating tracked weak maps, copying the original data so that muta
356
376
See [MDN for more information](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap)
357
377
358
378
```gjs
359
-
import { trackedWeakMap } from '@ember/reactive';
379
+
import { trackedWeakMap } from '@ember/reactive/collections';
360
380
import { on } from '@ember/modifier';
361
381
import { fn } from '@ember/helper';
362
382
@@ -380,7 +400,7 @@ A utility for creating tracked maps, copying the original data so that mutations
380
400
See [MDN for more information](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)
381
401
382
402
```gjs
383
-
import { trackedSet } from '@ember/reactive';
403
+
import { trackedSet } from '@ember/reactive/collections';
384
404
import { on } from '@ember/modifier';
385
405
import { fn } from '@ember/helper';
386
406
@@ -408,7 +428,7 @@ A utility for creating tracked weak sets, copying the original data so that muta
408
428
See [MDN for more information](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet)
409
429
410
430
```gjs
411
-
import { trackedWeakSet } from '@ember/reactive';
431
+
import { trackedWeakSet } from '@ember/reactive/collections';
412
432
import { on } from '@ember/modifier';
413
433
import { fn } from '@ember/helper';
414
434
@@ -469,7 +489,7 @@ We should do a codemod to convert the newable constructors from tracked-built-in
469
489
Using Vite or Webpack (Embroider 3+), we can alias `tracked-built-ins` to point at the new modules, using a shim -- for example:
0 commit comments