Skip to content

fix: route info segment overrides not updating in dev overlay - #96968

Open
mezotv wants to merge 1 commit into
vercel:canaryfrom
mezotv:fix/segment-explorer-trie-stale-snapshot
Open

fix: route info segment overrides not updating in dev overlay#96968
mezotv wants to merge 1 commit into
vercel:canaryfrom
mezotv:fix/segment-explorer-trie-stale-snapshot

Conversation

@mezotv

@mezotv mezotv commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Previously, when using the built-in route segment override in the Next.js dev tools (Route Info panel), the UI was not updating: after toggling a boundary (e.g. loading.js or not-found.js) you couldn't switch back unless you closed the modal and reopened it, which slowed down my workflow. It's not a huge issue, but I thought I'd fix it.

The cause was the segment explorer trie mutating nodes in place, so the panel's memoized view never picked up insertions until remount. Trie updates now copy the nodes along the mutated path (copy-on-write) so changed nodes get fresh identities while untouched subtrees stay shared.

Before

Switching from one override to another works, but the UI doesn't update — you have to close and reopen the panel.

Screen.Recording.2026-08-08.at.12.38.10.mov

After

Setting an override updates the DevTools UI immediately — no need to close and reopen the panel.

Screen.Recording.2026-08-08.at.12.35.33.mov

Verification

  • pnpm jest packages/next/src/next-devtools/dev-overlay/segment-explorer-trie.test.tsx
  • pnpm test-dev-turbo test/development/app-dir/segment-explorer/segment-explorer.test.ts
  • Manually verified in a dev app: toggling boundary overrides and "Clear Segment Overrides" now update the panel live.

The segment explorer trie mutated nodes in place and only shallow-copied
the root, so consumers memoizing on node.children never saw insertions
until remount. This made boundary overrides in the Route Info panel
render stale state: toggled boundaries didn't appear, and the boundary
picker disappeared after toggling or clearing overrides.

Insert/remove now copy the nodes along the mutated path so changed nodes
get fresh identities while untouched subtrees stay shared.
@mezotv
mezotv marked this pull request as ready for review August 8, 2026 10:41
@mezotv mezotv changed the title Fix Route Info segment overrides not updating in dev overlay fix: route info segment overrides not updating in dev overlay Aug 8, 2026
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