overengineeringstudio / overengineeringstudio/effect-utils

notion-react: relocating a cached <ChildPage> under a brand-new parent recreates it instead of moving

Open
#1,114 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:typescript origin:agent type:bug
Dominant language
TypeScript
Stars
82
Forks
2
Avg merge
1d 8h
Merged PRs (30d)
121

Description

Problem

The cross-parent move detection (pagesByKey + movePage) only runs inside diffChildren recursions over existing scopes. When a cached <ChildPage> is relocated under a brand-new parent (new page, toggle, or column), the new subtree is built by emitAppendsForNew / inlinePackChildren, which tail a fresh createPage for every page-kind candidate without consulting the cache. The old location then emits archivePage (the move is also not pre-claimed, since collectPreClaimedMoves does not descend into unretained candidates).

Net effect: the page identity churns (archive + recreate), server-side content is duplicated transiently, and any checkpointed pending state from #1100 is adopted but then discarded.

Repro sketch

  1. Warm sync <Page><A/><ChildPage k="c"/></Page>.
  2. Re-sync with <Page><A/><Toggle><ChildPage k="c"/></Toggle></Page> (toggle is new).
  3. Observe createPage(c) + archivePage(c-old) instead of movePage(c → toggle).

Suggested direction

  • Teach emitAppendsForNew and the inlinePackChildren tail path to emit movePage (parent = tmp id, resolved at apply time) when a page-kind candidate's key exists in pagesByKey.
  • Extend collectPreClaimedMoves to recurse into unretained candidate subtrees so the outgoing parent skips the archive.
  • Recurse content reconciliation into moveSource.children vs the candidate subtree after the move.

Related: #1100 (pending page-create checkpoints) — its adoption now runs before cross-parent matching, so this gap is the remaining convergence hole for relocated pages.

Posted on behalf of @schickling
field value
agent_identity unknown
agent_persona generalist
agent_supervisor unavailable
agent_tool OMP
agent_tool_version 18.0.3
agent_runtime OMP 18.0.3
tooling_profile dotfiles@f33cd9c-dirty

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with emitAppendsForNew, the inlinePackChildren tail path, and collectPreClaimedMoves, then trace pagesByKey and movePage through the existing diffChildren logic. Reproduce the new-parent Toggle case described in the issue and inspect how moveSource.children is reconciled. Done means the cached page uses movePage, the old location skips archivePage, and the page is not recreated.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.