Fork me on GitHub
#re-frame
<
2019-02-09
>
Bravi00:02:14

it means using the same code on the server and client. like react does https://github.com/DavidWells/isomorphic-react-example so having a single component that is rendered on the server and on the client. on the first page load, it is rendered on the server and then SPA takes over

Braden Shepherdson04:02:23

well, you can render a Hiccup template easily enough, and I think the subscription system works. so if the server supplies an app-db, it should be practical to do an initial render. the hard part would be adjusting the app as shipped to have it attach to the already-created DOM instead of rerendering it. I have no idea how hard that would be.

Bravi16:02:54

that can be done through react-dom/hydrate. I’ve already done that part. but I was thinking more about subs and dispatch.. I guess I just have to play around with it

lilactown19:02:06

well, subs and dispatch don’t make a whole lot of sense on the server-side. if you’re just filling in the initial state, it’ll probably work

lilactown19:02:33

the biggest issue is preventing two requests clobbering if you have per-request state in the app-db

lilactown19:02:31

if only re-frame’s re-frame.db/app-db was marked ^:dynamic, you could use binding inside of your route handler on the server to provide a new app-db per request