-
Notifications
You must be signed in to change notification settings - Fork 28
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
Write example recipe for SSR #53
Comments
I haven't moved my full thought train here yet, but what i envision is full SSR capability. How we'll achieve that is by loading up the state on the server & then sending the state down the wire. At first glance, it may seem odd that the redux state has some state & the singleton has other "state". But, if you look closely, the singleton actually only holds "computed values" (term borrowed from MobX). That means we can recreate the singleton based solely off of the redux state. 🔥. After all, cashay is just a cache, your state stays in redux 😉 |
That makes a ton of sense to me. Perhaps this issue can become the tracking issue? I'd like to make a list of all the issue deps for Action Cashay refactor so we can prioritize effort... |
Done, i started writing recipes on my new working branch (mostly for me, but i guess it'll be useful for other folks, too). I'll keep this issue open & write up a recipe after we implement it successfully in Action |
Awesome! This will be helpful. I have questions but will hold off and go through your examples when posted. |
Alrighty, finally digging into this & the reason it barfs right now is because I recommend you import the singleton from something that's only created client side, and of course the An easy fix would be a webpack |
another idea would be to cache the singleton in cashay. that way you could say |
a 3rd would be to do away with the so this
becomes this:
calling |
I am having recollections of managing the react-look singleton. Remember those days? Which are you leaning toward? Jordan On Jun 15, 2016, 11:14 -0700, Matt Kricknotifications@github.com, wrote:
|
@jordanh i've blocked those from my memory, they never existed la la la. Happily, the solution we came up to fix that react-look problem works here, too. But let's imagine that we didn't do that fix...
those who don't use webpack won't have this double instance problem, so it's safe to assume they can use compilation-time variables. |
Beautiful! As long as the state can be rehydrated, I am all good! Jordan On Jun 15, 2016, 16:30 -0700, Matt Kricknotifications@github.com, wrote:
|
This is something I wished I would have asked you about when we were laptop-to-laptop last week.
A universal app has two stores, one for the SSR and one for the client (which can be delivered to the client from the SSR). Following the pattern from Meatier and Action, these stores are created in:
src/server/createSSR.js
src/client/client.js
For testing purposes, our application is currently pulling in the Cashay singleton from
src/client/client.js
into its universal components. This does Bad Things™ during a production build (npm run build:server
).What's the recommended pattern here?
src/universal/...
and should it import the appropriate store (exported bysrc/server/createSSR.js
orsrc/client/client.js
) depending on which context it's running in?The text was updated successfully, but these errors were encountered: