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
feat: add toArray() for includes subqueries (#1295)
* feat: add toArray() for includes subqueries
toArray() wraps an includes subquery so the parent row contains
Array<T> instead of Collection<T>. When children change, the parent
row is re-emitted with a fresh array snapshot.
- Add ToArrayWrapper class and toArray() function
- Add materializeAsArray flag to IncludesSubquery IR node
- Detect ToArrayWrapper in builder, pass flag through compiler
- Re-emit parent rows on child changes for toArray entries
- Add SelectValue type support for ToArrayWrapper
- Add tests for basic toArray, reactivity, ordering, and limits
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Removed obsolete test
* Small fix
* Tests for changes to deeply nested queries
* Fix changes being emitted on deeply nested collections
* ci: apply automated fixes
* Changeset
* Add type-level tests for toArray() includes subqueries
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ci: apply automated fixes
* Rename Expected types in includes type tests to descriptive names
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix toArray() type inference in includes subqueries
Make ToArrayWrapper generic so it carries the child query result type,
and add a ToArrayWrapper branch in ResultTypeFromSelect to unwrap it
to Array<T>.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix toArray re-emit to emit change events for subscribers
The toArray re-emit in flushIncludesState mutated parent items in-place
before writing them through parentSyncMethods.begin/write/commit.
Since commitPendingTransactions captures "previous visible state" by
reading syncedData.get(key) — which returns the already-mutated object
— deepEquals always returned true and suppressed the change event.
Replace the sync methods pattern with direct event emission: capture a
shallow copy before mutation (for previousValue), mutate in-place (so
collection.get() works), and emit UPDATE events directly via the parent
collection's changes manager.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add change propagation tests for includes subqueries
Test the reactive model difference between Collection and toArray includes:
- Collection includes: child change does NOT re-emit the parent row
(the child Collection updates in place)
- toArray includes: child change DOES re-emit the parent row
(the parent row is re-emitted with the updated array snapshot)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ci: apply automated fixes
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
0 commit comments