Fork me on GitHub
#rum
<
2016-07-15
>
tap06:07:28

I’m playing with Rum’s Server-side rendering(https://github.com/tonsky/rum#server-side-rendering). What’s the approach for sharing data between server and client? For example, I render a collection which queried from database on server-side. How do I get an access to manipulate this collection on client-side? Should I make a separate ajax call to retrieve similar data? Is there a better way to do this?

chrisetheridge08:07:07

i’d do an ajax call @tap

chrisetheridge08:07:20

render your initial data, then setup a periodic ajax call if you want periodic updates. you can then use ajax to post updates on your data

tap08:07:49

I’m just doing live filtering on that data. There’s no update at the moment. It would be ideal if I can piggyback the data with the first html load.

tap08:07:55

Hmm.. Maybe I can do that too

chrisetheridge08:07:06

live filtering client side?

tap08:07:35

Search on description

tap08:07:50

And hide unmatched data

tap08:07:49

It just a that if I don’t need ajax call, I can remove an api endpoint and some dependencies. But I think eventually I’ll do more, so I think I’ll need those anyway

chrisetheridge10:07:20

what dependencies are you using for ajax?

tap11:07:14

ring-json on server side and cljs-ajax on client-side

chrisetheridge11:07:11

well, you can use goog.net.xhrio instead of cljs-ajax

chrisetheridge11:07:50

and you get them for free, since the closure library is used when compiling cljs to javascript — no dependencies need to be added

Niki14:07:22

@tap we solved that by baking in serialized data to HTML page, find it when page loads on client

tap14:07:48

Btw, I'm still seeing the issue with unmatched checksum when render server side and mount on client side on the latest version. Will try to replicate and file an issue.