Fork me on GitHub
#fulcro
<
2018-09-26
>
levitanong12:09:12

So… i’m trying to use the form-state stuff, but whenever i call entity->pristine*, i end up with a weird nil entry in the top level of my db, with a copy of my db as the value of that nil entry. Any ideas as to why this is happening?

{:foo :bar}
becomes
{nil {:foo :bar}
 :foo :bar}

levitanong12:09:03

Ah, nvm. Figured it out. Looks like if I am going to use fs to edit an existing entity that i get from the server, I have to wrap the incoming data with fs/add-form-config

kirill.salykin13:09:46

is it possible to dispatch mutation based on keyword (:keyword) not a symbol?

wilkerlucio13:09:58

nope, but wondering why would you want that?

kirill.salykin14:09:16

first there is no need in quoting also frontend and backend can have mutations in different namespaces

kirill.salykin14:09:33

why would I want it to be a symbol?

wilkerlucio14:09:32

the reason is to separated the "spaces" of it, you can think that keywords are always a unit of read, they are about data, while symbols are like functions, they imply something will happen, more like some operation

wilkerlucio14:09:46

kind like using keywords to read data from maps while symbols call functions

kirill.salykin14:09:50

k, reasoning seems clear. Cant say I think such separation is needed, but it makes sense… is it possible to have mutations in different namespaces on front/back end?

johnny14:09:14

Yes, you change that in the ast before sending it to the server.

wilkerlucio14:09:30

yeah, think as symbol ns as same as kw ns, you can use any of then anywhere

wilkerlucio14:09:14

and what jonny said, you can change the symbol before sending to server

kirill.salykin14:09:27

but then frontend should kinda know about backend structure?

kirill.salykin14:09:18

it is not related to code structure

kirill.salykin14:09:47

eg employee/update symbol same as :employee/update keyword

kirill.salykin14:09:12

it doesnt meen update mutation should be inside employee names, it is just a key used in multimethod

johnny14:09:53

Yeah that's correct

kirill.salykin14:09:32

clear, @ @ thanks!

johnny14:09:54

Good luck! 🙂

tony.kay15:09:47

@ Also look at this issue: https://github.com/fulcrologic/fulcro/issues/238 It discusses some ideas about how to code things so you don't need quoting.

sihingkk18:09:27

hey, there is perhaps silly questions, I was trying to use localised-dom and it work as long I put css into defsc. when I extract it to def and reference it it immediately breaks o.O I was thinking about to use localised css but keep css in seperate files or just in other part of file, as usually when you read the logic you are not concern about styling. any ideas what I can do wrong? should I just create example project illustrating this issue and add ticket?

tony.kay18:09:25

@sihingkk The localized DOM elements work by looking at a dynamic var that holds the “currently rendering” component.

tony.kay18:09:26

That is a documented and expected behavior. Use get-classnames to get localized names in non-rendering contexts, and then just use regular DOM to render the classes.

sihingkk09:09:10

many thank 🙂