Fork me on GitHub
#fulcro
<
2018-12-27
>
juri01:12:37

@currentoor Thanks for taking a look. Yes I understand the keys. But I am providing keys. I have an initial state with a key (`:week/number`), and the Week I df/load also has a key. If I'm not mistaken it's Fulcro or React or something that sets this to nil while loading. But I only get the React warning (red text in the image above) when I load both Person and Week, and even though both of these get nil keys while loading, they shouldn't interfere with each other. Am I correct? I'm loading one Week one time, and one Person one time. And the strange thing is, why is it rendering Person two times, even though I only make one call to the factory ui-person? Doesn't seem like something that should happen even if my keys are wrong.

juri02:12:25

If I set initial state of the Week :week/number to e.g. 52, and the same for Person :db/id to 52, then three Person are rendered -- one with id 52, one with id nil, and one with id 1, the last of which is loaded in :started-callback. I also get another React warning about the same key 52, even though Person and Week are unrelated. (The Week and Person are called :selected-week and :current-user in the client db)

eric.shao03:12:32

@tony.kay Thank you for reply. So the RN-CLIENT side codes are right? Especially this part:

:networking {:remote (net/fulcro-http-remote
                                    {:url                ""
                                     :request-middleware net/wrap-fulcro-request})}
and the (df/load app :current-user com.wsscode.multi-timer.components.person/Person)) is auto with transit+edn encode, right?🙂

eric.shao12:12:28

About #268 I try my best to understand it ,I hope I can fix it.

tony.kay17:12:58

@eric.shao I have not worked with RN, but that looks reasonable

Björn Ebbinghaus20:12:44

@tony.kay I'm a bit confused. I get this error defsc-router options are invalid: ... failed: (contains? % :ident) spec: :fulcro.client.routing/defsc-router-options ... But the docs for defsc-router state: > You may NOT define a :query, :ident, or :initial-state for a router. On the other side in the Book (http://book.fulcrologic.com/#_details_on_code_defsc_router_code): > The required parameters of defsc-router are: ... :ident MUST be in fn form, ... My root-router works without ident.

tony.kay20:12:16

I don’t see where you’re reading the first thing

tony.kay20:12:24

ident is required, and must be in a lambda form

tony.kay20:12:37

unless it is the docstring, which would be incorrect

Björn Ebbinghaus20:12:45

It is the docstring

tony.kay20:12:56

tehcnically you’re not setting theident of the router, you’re telling the router what the ident of the routees are

tony.kay20:12:12

so both are technically correct statements

tony.kay20:12:41

the router’s ident is not settable by you, because you cannot even get to the “knob”

Björn Ebbinghaus20:12:41

Ah my root-router doesn't work without ident.

tony.kay20:12:40

but I’ll fix the docstring

Lennart Buit20:12:20

A colleague of mine ran into encoding issues with server side rendering which generated invalid javascript/JSON strings in the initial state script tag. Would you be interested in discussing these troubles in like an issue? We ended up b64 encoding/decoding. That works, but I think this issue may bite more fulcro users so I was wondering whether you wanted to have patches/discussion on the topic ^^

tony.kay20:12:34

@lennart.buit strange, I thought I had fixed all of those. Sounds like there are some strange cases that still don’t work. I’m open to a PR that corrects this, of course. I think as long as the encode/decode pair work as such, whatever is needed is fine.

tony.kay20:12:46

just in case others have used those transit->str functions, we might just want to add variants called clj->str and str->clj?

tony.kay20:12:37

the use of transit is probably important since transit is extensible for Fulcro in general

tony.kay20:12:48

but base64 encoding to prevent issues is fine

Lennart Buit20:12:07

the issues mostly arise from the combination of javascript strings with JSON. for example "\u0001" is a valid JS string, but gets transformed by JS to the actual unicode character. JSON however prohibits unicode characters with a codepoint <=31 in strings.

Lennart Buit20:12:27

I’ll make sure we will upstream our patch tomorrow!

tony.kay20:12:08

great, thanks!

Lennart Buit22:12:29

As promised, https://github.com/fulcrologic/fulcro/pull/269, these changes always take way longer than you would hope right :’).