-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example with Next.js SSR? #45
Comments
Hi @tyteen4a03 . I'm happy to put one together. Is there like a Next.js playground somewhere I can put it on? Or should I just make a new github project example? |
Next.js has a sample blog app: https://nextjs.org/learn/basics/create-nextjs-app |
I've been trying to put together an example today - but Next.js SSR is not the easiest thing to do server customization stuff on. You need to have some control over the server-side of things, to create the initial store provider and then be able to initialize whatever state you want per route. It seems Next.js allows you to run a If you don't have any state to initialize on the server though, then of course its no problem and you can just make use of Pullstate client-side only. But I assume you want to do some per-page state initialization? Or want to make use of Async Actions and resolve the data fetching on the server before rendering? I might have to look into creating a custom |
Pullstate looks really great, congrats :) Has anyone integrated Next.js and Pullstate? |
Thanks @gusaiani :) I'll try and take another shot at this soon, seeing how Next.js seems to be rather popular these days. Would be nice to have an easy solution for it. |
Thank you @lostpebble. We'll be very inclined to adopting Pullstate at http://www.getcircuit.com with Next! |
I'm using Pullstate with Next.js and it works great, except for Fast Refresh. After a fast refresh the store won't update. Trying to figure out what's going on but I posted a small repro over on a Next.js issue: vercel/next.js#13268 (comment) |
Hi @mlynch - I've released |
@lostpebble you legend! Works great, did not expect to wake up and see this. I love pullstate, thanks so much! |
Hahah awesome! Glad to hear its all working, and cheers for the kind words! :) Appreciate your share on Twitter the other day too - it really pumped up the exposure! |
Of course! I expect a lot more people to be using this in time. Also not sure if you saw my dev.to article, let me know if I got anything wrong: https://dev.to/ionic/pullstate-simple-hooks-based-state-management-for-react-5bc4 |
Oh jeeze, can't believe I forgot about the article! Yea, loved it- really nice and concise introduction in a great format. Also nice that you went into some of the gotchas of the mutations, something actually overlooked in the pullstate docs and should be mentioned. Really appreciate you putting it together, and on a personal level its a great feeling to see someone write about your project (especially someone who knows their way around this industry)- so thanks for that :) |
Hi guys, I'm trying to make pullstate (love the library!) work with Next.js, here's the example PR: vercel/next.js#20078 The only issue is the warning that I'm getting in the console: Pullstate: createPullstate() - Should not be creating the core Pullstate class more than once! In order to re-use pull state, you need to call instantiate() on your already created object. I'm not sure how to go about solving it. Any ideas? |
Hi @xeoneux , and thanks glad you're enjoying the library :) Also, thanks for trying to get an example put together with Next.js! Are you still having the issues? I tried your PR example in the Next.js repo- and all seemed fine, except for a missing import of: import { PullstateCore } from '../stores' in After that, it built and ran without any issue. The Let me know if this is still an issue and I'll dive into it deeper. |
I'm getting this same issue as well . Would anyone being willing to take a look at my code and help me figure out why this warning keeps popping up? I'm using SSR |
Is there an example of using this package with Next.js's SSR?
The text was updated successfully, but these errors were encountered: