Skip to content

Commit 9aeeb4f

Browse files
committed
fix(theme): use a getter as VPSidebar's open watch source
`watch([props, navEl], ...)` is only accidentally valid on the client, where props reaching setup are shallow-reactive. During SSR props are not reactified (dev mode additionally wraps them in shallowReadonly), so dev-flavored SSR warns "Invalid watch source: Proxy({ open: false })" once per rendered page. Normally invisible because build() forces NODE_ENV=production before vue loads — but any process that already required vue under a different NODE_ENV (programmatic builds inside test runners) keeps dev vue in the module cache and surfaces it. Repro (pure Vue, no vitepress): renderToString of a component doing watch([props, ref], cb, { immediate: true, flush: 'post' }) under dev vue. Watching `() => props.open` expresses the actual dependency and is valid in both environments.
1 parent 548a606 commit 9aeeb4f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/client/theme-default/components/VPSidebar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const navEl = ref<HTMLElement | null>(null)
1515
const isLocked = useBodyScrollLock()
1616
1717
watch(
18-
[props, navEl],
18+
[() => props.open, navEl],
1919
() => {
2020
if (props.open) {
2121
isLocked.value = true

0 commit comments

Comments
 (0)