Clojurians
# om

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

sova 02:42:16

Hello everyone. Has there been any further work on Serverside rendering with om(next)? I'm tempted to SSR my pages and have them get overwritten by the js app loading (since the ReactIDs don't work out to be the same)...

sova 02:42:35

Checksum issue? I'm really looking forward to the day when SSR is a one-liner.

petterik 04:16:10

@sova Which om.next version are you on? There was one SSR fix that had to do with html-escaping the :style map (css values). React usually says exactly where the checksum missmatches. What does your error say?

anmonteiro 04:30:11

Server-side rendering (with checksums getting picked up) has been fairly stable since September when Cellophane was merged in Om Next

anmonteiro 04:30:29

AFAIK there have been like 2 or 3 fixes to SSR since then

mping 13:04:57

is there a reference frontend/backend om.next app? something I could use to learn om.next?

mping 13:05:07

ideally with SSR, backend api, etc

baptiste-from-paris 13:14:09

@mping you have todomvc by David Nolen if I remember well

mping 13:14:58

@baptiste-from-paris is that for om.next? also dont think there is backend involved

baptiste-from-paris 13:18:35

with a datomic back-end

baptiste-from-paris 13:18:53

you also have some nice tutos by the untangled team

baptiste-from-paris 13:20:01

it’s about untangled but it can help you understand om.next

emiluren 14:20:52

Is there a "proper way" to deal with state that isn't in your app-state map in Om?

I'm making a simple music player with Om.next and howler.js. To play/pause audio and so on I need to call methods on js objects. Right now I'm just calling them from action thunks in my mutate function but I don't know if there's a better way to do it since I guess you lose stuff like going back in history.

danielstockton 14:24:47

@emiluren Is there no way to make everything completely deterministic?

danielstockton 14:27:13

Here's a general question to the channel:
I have a :start and :end on my app-state that determines the time period for all reports and I have a problem getting the right follow-on reads to run, every time I change them.
All these reads are in the :reports/ namespace. Do you think it's a good idea to read the current root query, transform it to ast, extract all the :reports/ keys and add those as trailing reads to the transact which updates start/end?

emiluren 14:32:43

@danielstockton I don't know. Maybe I could make some sort of data format that describes the state of an audio object and make sure it is in that state in my render function or something but it feels hacky and hard to get right

danielstockton 14:34:08

@emiluren render or other lifecycle methods. Anyway, I think that's what you'd have to do or else accept that some things are outside of deterministic history.

danielstockton 14:34:40

In order for you to retain proper history, you'd have to do this one way or another.

emiluren 14:34:59

Ok, thank you for your help :slightly_smiling_face:

danielstockton 14:42:16

The other way I can think to do this is to define all the report reads in one place, define which are acceptible for a given route, and then check the route before firing off requests in my parsers.

danielstockton 14:42:31

That might be simpler actually.

anmonteiro 17:06:38

@mping same version of todomvc but with SSR https://github.com/anmonteiro/om-next-fullstack

peeja 19:51:59

@emiluren That actually sounds best and not hacky at all to me. I mean, you'll probably need to do a little fudging to make it work with an external object that's changing state in real time, so there may be some hacks there, but the approach in general sounds to me like the right application of React principles.

gardnervickers 20:03:24

@anmonteiro We started using plomber for our dev build and would love to have it published at some point. Totally understandable if you don’t want to have to maintain that, just mentioning because I saw there’s a note about it in the README :smile:

anmonteiro 20:04:20

@gardnervickers :slightly_smiling_face: I just didn’t publish it because I thought nobody would use it

anmonteiro 20:04:42

also the name was a stupid pun at the time

gardnervickers 20:05:02

It’s proved very useful for tracking down problems where pathopt fails and triggers a root render.

anmonteiro 20:05:09

oh wth, I even have docs for it

anmonteiro 20:05:21

I don’t remember this being in such a good state

anmonteiro 20:05:25

cutting a release now

anmonteiro 20:18:08

I wonder how you found it though

anmonteiro 20:18:24

I never really advertised Plomber :slightly_smiling_face:

gardnervickers 22:52:17

@anmonteiro I was looking through Compassus a while back and must have stumbled upon it somehow and it’s stuck in my brain :smile:

gardnervickers 22:53:34

Does the presence of a link in a query have an effect on if a component can utilize path optimization?