Component works fine in dev mode but broken in production #217
Replies: 1 comment 2 replies
-
Never mind! I was able to figure this out, although I'm not sure if my solution should be considered canonical, so let me know if there's a better way. Basically, I extracted out the toggler in <!-- DrawerToggler -->
<template>
<button @click="toggleDrawer">
Show/hide drawer
<button>
</template>
<script setup lang="ts">
const toggleDrawer = () => {
// Drawer toggle logic using nanostores
}
</script> And now my navbar component is "flat" in the sense that it wraps hydrated components but doesn't have any of its own Vue logic: <!-- Navbar.vue -->
<template>
<nav>
<DrawerToggler client:load />
<!-- other navbar stuff, including other hydrated components -->
</nav>
<!-- Drawer.vue shown below -->
<Drawer client:load />
</template> Ideally this wouldn't be an issue and you'd be able to apply Vue logic and wrap other hydrated components in an îles component, but this may not be feasible. |
Beta Was this translation helpful? Give feedback.
-
I'm a bit stumped on something. I have a slide-in drawer for a site I'm building that works fine in dev mode but is broken in the deployed site. I suspect there's a hydration problem but I can't seem to pinpoint it. First, I have a navbar with a toggler that controls the drawer (a lot has been omitted for brevity):
The Vue template for the drawer:
For some reason this works fine when I'm in
iles dev
mode but when I click the navbar button in the prod site, nothing happens. It's strange because I have other hydrated components withclient:*
statements in the navbar, like a dark/light mode toggler and some dropdowns, and those all work fine. But for some reason the drawer component only works in dev mode.Does anything jump out at anyone as obviously incorrect here?
Beta Was this translation helpful? Give feedback.
All reactions