Fork me on GitHub
#om
<
2016-08-15
>
grzm15:08:02

How are people integrating a "current user" into their apps? I haven't seen many (any?) examples out there in the wild.

anmonteiro15:08:36

@grzm: if you鈥檙e using normalized data, links are the way to go https://github.com/omcljs/om/wiki/Thinking-With-Links%21

grzm15:08:23

@anmonteiro: thank you. and firchrissakes, there's even current-user on that page

grzm15:08:03

Can links be used when returning data from the server as well?

grzm15:08:27

i.e., in the response?

grzm15:08:58

I don't want to unnecessarily transfer redundant data back to the client.

anmonteiro15:08:46

@grzm: links are supposed to be a client-only thing.

anmonteiro15:08:07

that said, you can of course update the data that they refer to whenever the server sends something back

grzm15:08:01

I'm thinking of something like a todo list that's owned by a particular person.

grzm15:08:42

I don't want to return all of the user information that the app might need for that person every time I fetch the todo list.

anmonteiro16:08:26

@grzm: just a question of eliding that from the query you鈥檙e sending to the server

solussd18:08:05

@anmonteiro: thanks for the help with the union queries. They鈥檙e working with one remaining issue鈥撀爐he data is not being normalized. Using union queries doesn鈥檛 affect that, correct? (I have the mapentry [:normalize true] in my reconciler args)

anmonteiro18:08:28

@solussd: a number of things could be going on

anmonteiro18:08:43

:normalize true in the reconciler args will not normalize your data if you pass it inside an atom

anmonteiro18:08:58

if you want normalization to occur during initialization, pass your state as a map

solussd18:08:36

@anmonteiro: the data retrieved from the remote is not being normalized when merged into the local state. My initial state is just a map

anmonteiro18:08:08

@solussd: with union queries you might need to tweak the queries that are sent to the remote

anmonteiro18:08:19

and pass the query as the second argument to the callback in your send function

solussd19:08:39

hmm, the queries look correct, I鈥檓 sending the query to the callback as suggested, but still not normalizing . very strange

solussd19:08:46

and the queries are retrieving data (and populating the state, denormalized)

solussd20:08:57

@anmonteiro: even stranger , if I don鈥檛 use a union query at all and I send, as the query to the callback, the query from the app-root (which is what is used by default if you simply pass nil) it doesn鈥檛 normalize, but if I send nil it does.

solussd20:08:15

I even added the same metadata