new function useOnClient or something like watchWithFilter to run on client only
See original GitHub issueHi,
I have used vueuse in my VueJS project a lot and recently I started working on Nuxt (SSR), the problem I am facing is I am having a hard time using some composable function that runs on a client like useWindowSize
. You can check this conversation: https://github.com/nuxt/framework/discussions/1702
I asked about the same but didn’t get much luck: https://github.com/vueuse/vueuse/issues/881 https://github.com/nuxt/framework/discussions/1702
I think it will be great to provide a guide or something to quickly get started with SSR and vueuse.
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (9 by maintainers)
Top Results From Across the Web
How to use Apollo Client with Remix - Apollo GraphQL Blog
From the Remix docs: “This may ask you whether you want to install create-remix@latest . Enter y . It will only be installed...
Read more >Server-side vs. client-only rules - Microsoft Support
Rules are either server-side or client-only based on the conditions and actions you apply to them. ... This rule uses all Exchange server...
Read more >Call Server side functionality from the Client sid... - ServiceNow
Hi everyone, I had an issue today with getting the user's group ( simple gs.getUser().isMemberOf(' ') ) from Catalog UI Policy. As I....
Read more >How do I detect whether I am on server on client in next.js?
It's running within a container. I am doing an http request with isomorphic-fetch to get data for my render. I'd like to do...
Read more >How to use client-side only packages with SSR in Gatsby and ...
js to take advantage of static site generation or server-side rendering and its performance benefits because that's what Youtube/StackOverflow/ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, I have the same problem with Nuxt3 and useBreakpoints on a desktop. I create
const smAndLarger = breakpoints.greater('sm')
which is false on SSR and true on desktop. I have a menu<n-menu :mode="smAndLarger ? 'horizontal' : 'vertical' "></n-menu>
. The menu is vertical at the begining and should be horizontal then but it always stays vertical except if I reduce the browser window and increase it again. Doing something like this in script setup, solves the problem:and then
<n-menu :mode="mobile ? 'horizontal' : 'vertical' "></n-menu>
. So it seems the initial value after hydration doesn’t trigger template rendering.And I think your CSB also works for me
(yes it’s initially zero since it comes from the server-side, you will need to wait for client-side hydration to have it updated.