Repository navigation
Host core: the projection's selectors and selection without React - #149
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Active findings show that in-place mutations can suppress required init updates and alter earlier payloads, while abandoned renders can trigger unnecessary reinitialization and filtering updates through shared caches.
2 open issues
What changed in this PR
Implements step 4 of the headless-store design by extracting selector, selection, and status-reporting logic from React hooks, preparing it for store composition without changing ProjectionController.
Changes:
- Adds memoized selectors for row filtering and renderer payloads.
- Extracts selection helpers, an interaction reducer, and status-event reporting.
- Adds Node tests and updates the design note and machine-check baseline.
| File | Description |
|---|---|
tools/scripts/check-machines/baseline.json |
Removes the payload ref-latch baseline entry. |
packages/host/core/test/store-selectors.test.mjs |
Tests selectors, interaction, selection, and status events. |
packages/host/core/src/projection/use-projection.ts |
Integrates the interaction reducer. |
packages/host/core/src/projection/stage-binding.ts |
Dispatches anchor and frame-replacement events. |
packages/host/core/src/projection/selection.ts |
Extracts selection helpers and change reporting. |
packages/host/core/src/projection/payloads.ts |
Extracts the memoized renderer-payload selector. |
packages/host/core/src/projection/paint.ts |
Extracts framework-independent status-event reporting. |
packages/host/core/src/projection/memo.ts |
Adds shared one-slot memoization helpers. |
packages/host/core/src/projection/interaction.ts |
Adds the pinned-target, hover, and anchor reducer. |
packages/host/core/src/projection/filtering.ts |
Extracts the memoized row-filter selector. |
docs/design/proposals/headless-store.md |
Documents step 4 and clarifies step 5 integration. |
Review effort: Balanced
agorischek
force-pushed
the
store-selectors
branch
from
November 21, 2026 19:37
ebea250 to
a4721a2
Compare
agorischek
force-pushed
the
playback-store
branch
from
November 21, 2026 19:37
ad8236f to
191eec2
Compare
agorischek
force-pushed
the
store-selectors
branch
from
November 21, 2026 20:20
a4721a2 to
4c78212
Compare
The row filter and the renderer payloads become framework-free selectors (createRowFilter, createRendererPayloads), built from one-slot memos so each result keeps its identity while its inputs do. Selection is pure functions, and the pinned target, hover and anchors are one reducer (interaction) that useProjection runs with useReducer. The renderer status and painted events are told by createStatusEvents. The hooks keep only React's part. Step 4 of the headless store design. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
agorischek
force-pushed
the
store-selectors
branch
from
November 21, 2026 20:59
4c78212 to
21856a2
Compare
…ed by JSON are copies Each memo compares first with the values last committed, then with the last computed, and computing never replaces what was committed: a render React throws away no longer evicts the committed results, so a still-shown subject keeps its init and rows. The hooks commit after each committed render; a vanilla host commits after each read. byValue keeps a parsed copy, so a focus or kinds changed in place is a new init, and payloads share nothing with the host's objects. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

Step 4 of the headless store design (
docs/design/proposals/headless-store.md), stacked on #148.createRowFilter(rows, scope, counts, what Changes hides, the filter payload) andcreateRendererPayloads(init, environment, progress, endpoints, a static diff's progress) are framework-free.projection/memo.ts), so each result keeps its identity while its inputs do, as the React memos did.selectionOf,selectedPaths,selectedTarget,targetSelection, pluscreateSelectionReportforonSelectionChange.projection/interaction.ts) thatuseProjectionruns withuseReducer.anchoredandframeReplacedevents instead of callingsetAnchorsupdaters.createStatusEvents, whichuseStatusEventscalls after each commit.ProjectionControlleris unchanged, and nothing new is exported; the store composes these in step 5.check:machinesbaseline is lowered by one, sincepayloads.tsno longer holds a ref latch.test/store-selectors.test.mjs) cover selector identity, the payloads' rules, the reducer, the selection helpers and the status events, without React.