Fork me on GitHub
#om
<
2017-06-06
>
sova-soars-the-sora03:06:02

Hello, how can I shuffle an om/props ?

sova-soars-the-sora03:06:16

I tried doing (take 8 (shuffle (map blurblist (-> this om/props :blurbs)))) but that was hilarious ... as it would shuffle the whole set on every mouse move.. every pixel change on mouseOver triggered a shuffle + redraw

sova-soars-the-sora03:06:03

So I'm trying to shuffle some section of my nf-app-state-atom but only once per page load if possible...

sova-soars-the-sora03:06:24

Let me know if I'm not making any sense / need more info

drcode03:06:41

@sova I'd put a random seed in app-state, then use one of gary fredericks' libraries to always shuffle the same way https://m.curiosity.com/videos/gary-fredericks-purely-random-clojuretv/

sova-soars-the-sora04:06:23

that's actually a really slick idea

sova-soars-the-sora04:06:28

now that i see how he does it in the video

uwo16:06:42

When handling references on the front end, do most of you work with the :db/id from datomic? I have a colleague that thinks datomic ids shouldn’t leave the server, and if you need to refer to a ref within datomic you should use a uuid. I don’t personally see a need to use uuids until I’m communicating with a separate system. (of course, there is the question of where that line begins)

sova-soars-the-sora18:06:59

@uwo I use a roundabout way of updating my app-state-atom via socket communications, so I never actually know what the DB is on about...

peeja18:06:32

Is there a way to trigger a re-read of the entire app query (without a reference to the root component)?

dirklectisch18:06:40

@peeja Wouldn’t you be able to access the root component by combining om.next/get-reconciler and om.next/app-root?

peeja18:06:09

@dirklectisch Oh! Yes, that'll work just fine. I didn't see app-root. Thanks!

drcode23:06:47

@uwo The usual pattern is to assign a tempid on the client (OmNext has a function for this) then pushing the new item to the server, then the server generates a :db/id, finally the server sends a map of tempid->db/id to the client, which the client uses to get back in sync. So usually having db/ids on the client is normal