Skip to content

Prototype immutable path writer - #3

Merged
hatim-s merged 3 commits into
mainfrom
prototype/path-aware-immutable-writer-v2
Jul 12, 2026
Merged

Prototype immutable path writer#3
hatim-s merged 3 commits into
mainfrom
prototype/path-aware-immutable-writer-v2

Conversation

@hatim-s

@hatim-s hatim-s commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Feature

Replace Bolt nested-path writes with a custom immutable writer that clones only the root and changed path ancestors. This keeps the public API and React snapshot semantics unchanged while removing Mutative from the hot nested-write path.

Architecture

Before:

set(path, value)
  -> Mutative draft
  -> lodash/set on draft
  -> finalized immutable state
  -> notify root + path prefixes

After:

set(path, value)
  -> read previous leaf
  -> compute next leaf
  -> Object.is no-op short-circuit
  -> clone root + path ancestors only
  -> assign leaf
  -> notify root + path prefixes

Notes

  • Root replacement remains direct assignment.
  • Parent/root subscribers still receive changed object references.
  • Sibling references are preserved.
  • Missing numeric branches still create arrays.
  • Mutative dependency and library external config are removed.

Validation

  • bun run test
  • bun run build:lib
  • bun run build

hatim-s and others added 3 commits July 10, 2026 12:53
Co-authored-by: GPT 5.5 <codex@openai.com>
Co-authored-by: Zed <zed@zed.dev>
Co-authored-by: GPT 5.5 <codex@openai.com>
Co-authored-by: Zed <zed@zed.dev>
Co-authored-by: GPT 5.6 Sol <codex@openai.com>
Co-authored-by: Zed <zed@zed.dev>
@hatim-s
hatim-s force-pushed the prototype/path-aware-immutable-writer-v2 branch from 4448a36 to dc968f6 Compare July 12, 2026 09:00
@hatim-s
hatim-s merged commit f0a87bb into main Jul 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant