You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vitejs/devtools#527 ("session-scoped dock UI state — restore open/selected dock, tab, and scroll across reloads") by @dvcolomban restored the active ViewJsonRender spec tab + scroll position via sessionStorage, and which dock is open/selected via a new selectedId field folded into the existing localStorage-backed panelStore, so a dev-server restart or HMR full-reload doesn't drop back to the default dock. It touched packages/core/src/client/inject/runtime.ts, webcomponents/components/dock/DockEmbedded.vue, webcomponents/components/views/ViewJsonRender.vue, the json-render Select.ts/Switch.ts/Tabs.ts/TextInput.ts components, json-render/composables/{dock-entry-id,useUncontrolledValue}.ts, and webcomponents/state/{context,docks}.ts in vitejs/devtools, which moved here as part of the v0.9 migration. Equivalents today: packages/hub-ui/src/client/embedded/index.ts, packages/hub-ui/src/client/components/dock/DockEmbedded.vue, packages/hub-ui/src/client/state/{context,docks}.ts for the dock-side pieces, and packages/json-render-ui/src/components/{Select,Switch,Tabs,TextInput}.ts for the json-render pieces (composables likely live alongside them or in a shared packages/json-render-ui/src/ utils area — check current structure).
Original PR description
Why
Reloading the page (dev-server restart, an HMR full-reload, etc.) always dropped back to whatever dock is open by default, which gets annoying mid-debugging.
What changed
Restores the active spec tab and scroll position inside a ViewJsonRender dock — sessionStorage, keyed per dock and tab, since nothing server-side needs to see these and syncing them across tabs would be unwanted UX.
Restores which dock is open and selected — selectedId, folded into the existing localStorage-backed panelStore alongside open/mode/position/geometry, rather than a second store, since it's a browser-local singleton exactly like those already are.
Additional context
selectedId living in the same object as open means it inherits #525's shared-state mirror for free, if that one lands — no separate wiring needed there.
Port the dock-state pieces to packages/hub-ui/src/client/embedded/index.ts, components/dock/DockEmbedded.vue, and state/{context,docks}.ts.
Port the json-render pieces to packages/json-render-ui/src/components/{Select,Switch,Tabs,TextInput}.ts and wherever dock-entry-id/useUncontrolledValue composable equivalents now live — grep the current tree if they've been renamed or consolidated.
Credit @dvcolomban as the original author: include a Co-authored-by: dvcolomban <...> trailer (look up their GitHub noreply email, or omit if unavailable) and mention them in the PR description.
Context
vitejs/devtools#527 ("session-scoped dock UI state — restore open/selected dock, tab, and scroll across reloads") by @dvcolomban restored the active
ViewJsonRenderspec tab + scroll position viasessionStorage, and which dock is open/selected via a newselectedIdfield folded into the existing localStorage-backedpanelStore, so a dev-server restart or HMR full-reload doesn't drop back to the default dock. It touchedpackages/core/src/client/inject/runtime.ts,webcomponents/components/dock/DockEmbedded.vue,webcomponents/components/views/ViewJsonRender.vue, the json-renderSelect.ts/Switch.ts/Tabs.ts/TextInput.tscomponents,json-render/composables/{dock-entry-id,useUncontrolledValue}.ts, andwebcomponents/state/{context,docks}.tsin vitejs/devtools, which moved here as part of the v0.9 migration. Equivalents today:packages/hub-ui/src/client/embedded/index.ts,packages/hub-ui/src/client/components/dock/DockEmbedded.vue,packages/hub-ui/src/client/state/{context,docks}.tsfor the dock-side pieces, andpackages/json-render-ui/src/components/{Select,Switch,Tabs,TextInput}.tsfor the json-render pieces (composables likely live alongside them or in a sharedpackages/json-render-ui/src/utils area — check current structure).Original PR description
Diff: https://github.com/vitejs/devtools/pull/527/files
For agents picking this up
sessionStorage-keyed tab/scroll restoration and thepanelStore.selectedIdaddition.selectedIdsharespanelStorewith it.packages/hub-ui/src/client/embedded/index.ts,components/dock/DockEmbedded.vue, andstate/{context,docks}.ts.packages/json-render-ui/src/components/{Select,Switch,Tabs,TextInput}.tsand whereverdock-entry-id/useUncontrolledValuecomposable equivalents now live — grep the current tree if they've been renamed or consolidated.Co-authored-by: dvcolomban <...>trailer (look up their GitHub noreply email, or omit if unavailable) and mention them in the PR description.