-
-
Notifications
You must be signed in to change notification settings - Fork 589
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Reproduction
not needed, i know the cause and have a potential fix
Describe the bug
SidebarMenuSkeleton uses Math.random() to make random size.
const width = computed(() => {
return `${Math.floor(Math.random() * 40) + 50}%`
})This causes hydration error in Nuxt 4 - different numbers are obtained on the client and server.
Here is a possible fix:
const uid = useId()
const width = useState(`skeleton-width-${uid}`, () => `${Math.floor(Math.random() * 40) + 50}%`)System Info
Not neededContributes
- I am willing to submit a PR to fix this issue
- I am willing to submit a PR with failing tests
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working