Client: Add, drop and reorder the rows a collection's payload asks for - #2276
Merged
Conversation
|
View your CI Pipeline Execution ↗ for commit d1e5c4b
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
🌿 Interactive Playground and Documentation PreviewA preview deployment has been built for this pull request. Try out the changes live in the interactive playground: 🌱 Grown from commit ✅ Preview deployment has been cleaned up. |
commit: |
marcoroth
force-pushed
the
slots/collections
branch
from
August 18, 2026 02:57
75e84b4 to
d1e5c4b
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request lets a collection be edited and not only updated.
applyfilled the rows both sides already agreed on and deferred every change to which rows there were, so rows could never be added, removed or moved. Two thirds of that was pessimism: removing a row and moving one need no markup at all, only the row's own range.The third needed something to copy. Every row of a collection is the same shape by construction, so any row on the page is a template for the rest: one is cloned, emptied, given the key it is being built for, and filled from the payload like any other row. Which leaves one case that genuinely cannot be done, a collection with no rows at all, and that is what
deferrednow reports.So the server parks a row for a collection that rendered none, and
_herb_covered_branchesdoes the deciding exactly as it does for a branch: a collection with rows on the page marks itself covered and parks nothing, because the page already holds a better copy than the compiler could write. The parked row carries an empty key, since a row's key is an expression and has no static form, and whatever builds a row from it has to say which row it is building anyway.Parking happens before the key marker goes in and not after, because the statics printer refuses a tree it cannot print, and an expression is exactly what it cannot print. Parking afterwards silently parked nothing at all.
Two notes on the mechanics. The rows sort by moving each one to the end in the order asked for, measured against the collection's own closing marker, which is the one node no row can be inside, and that works in a table where the parser puts the rows in a
tbodyand leaves the markers around them at another depth. And JavaScript sorts integer-like object keys numerically, soJSON.parseloses the order the server wrote for a collection keyed by id. Ascending is what an append wants, so it rarely shows, but a collection whose order the server decides has to be keyed by something that is not a number. There is a test saying so.