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 +249,23 @@ For example, other future exports from `@ember/reactive` (in future RFCs), may i
248
249
without the static analysis guarantees of `type=module`, every consumer of `@ember/reactive` would always have all of these exports in their build.
249
250
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
251
252
+
#### Why are the collections under `@ember/reactive/collections`?
253
+
254
+
Placing the collections in the main export surface alongside core primitives like `tracked`, `cached`, `cell`, and `resource` may not conflate importance of the collections.
255
+
256
+
> [!NOTE]
257
+
> At the time of writing of this RFC, `tracked`, `cached`, `cell`, and `resource` RFCs have not been accepted for inclusion in `@ember/reactive`
258
+
259
+
This is motivated by actual usage out in the ecosystem of tracked-built-ins:
260
+
261
+
here are results from github.com searches for the `tracked-built-ins` equivalents (excluding ember-owned repos and forks of them):
262
+
- "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))
263
+
- "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)
264
+
- "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)
265
+
- "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)
266
+
- "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)
267
+
268
+
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
269
252
270
### Consumption
253
271
@@ -274,7 +292,7 @@ A utility for creating tracked arrays, copying the original data so that mutatio
274
292
See [MDN for more information](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)
275
293
276
294
```gjs
277
-
import { trackedArray } from '@ember/reactive';
295
+
import { trackedArray } from '@ember/reactive/collections';
278
296
import { on } from '@ember/modifier';
279
297
import { fn } from '@ember/helper';
280
298
@@ -301,7 +319,7 @@ A utility for creating tracked objects, copying the original data so that mutati
301
319
See [MDN for more information](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
302
320
303
321
```gjs
304
-
import { trackedObject } from '@ember/reactive';
322
+
import { trackedObject } from '@ember/reactive/collections';
305
323
import { on } from '@ember/modifier';
306
324
import { fn } from '@ember/helper';
307
325
@@ -328,7 +346,7 @@ A utility for creating tracked maps, copying the original data so that mutations
328
346
See [MDN for more information](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)
329
347
330
348
```gjs
331
-
import { trackedMap } from '@ember/reactive';
349
+
import { trackedMap } from '@ember/reactive/collections';
332
350
import { on } from '@ember/modifier';
333
351
import { fn } from '@ember/helper';
334
352
@@ -356,7 +374,7 @@ A utility for creating tracked weak maps, copying the original data so that muta
356
374
See [MDN for more information](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap)
357
375
358
376
```gjs
359
-
import { trackedWeakMap } from '@ember/reactive';
377
+
import { trackedWeakMap } from '@ember/reactive/collections';
360
378
import { on } from '@ember/modifier';
361
379
import { fn } from '@ember/helper';
362
380
@@ -380,7 +398,7 @@ A utility for creating tracked maps, copying the original data so that mutations
380
398
See [MDN for more information](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)
381
399
382
400
```gjs
383
-
import { trackedSet } from '@ember/reactive';
401
+
import { trackedSet } from '@ember/reactive/collections';
384
402
import { on } from '@ember/modifier';
385
403
import { fn } from '@ember/helper';
386
404
@@ -408,7 +426,7 @@ A utility for creating tracked weak sets, copying the original data so that muta
408
426
See [MDN for more information](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet)
409
427
410
428
```gjs
411
-
import { trackedWeakSet } from '@ember/reactive';
429
+
import { trackedWeakSet } from '@ember/reactive/collections';
412
430
import { on } from '@ember/modifier';
413
431
import { fn } from '@ember/helper';
414
432
@@ -469,7 +487,7 @@ We should do a codemod to convert the newable constructors from tracked-built-in
469
487
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