next.js
a8d18976 - fix: route info segment overrides not updating in dev overlay (#96968)

Commit
37 days ago
fix: route info segment overrides not updating in dev overlay (#96968) ## 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. https://github.com/user-attachments/assets/39e43ad7-2f14-4b54-bdab-eba51c87a060 ### After Setting an override updates the DevTools UI immediately — no need to close and reopen the panel. https://github.com/user-attachments/assets/113887cf-fe07-4d9b-90a5-405b53692a07 ## 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. <!-- NEXT_JS_LLM -->
Author
Parents
Loading