fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
tony.kay 2020-09-11T00:13:22.373100Z

A quick note on the new sync tx processing: I said this before, but do expect that it is mainly directed at testing at this point, and should be considered alpha. I don’t recommend switching to it in production, but please try it in dev and report issues. I’d love for this to become the de-facto transaction processing, but I have not had time to vet it heavily. It has worked in my limited testing but I have already seen minor visible differences that will matter, and might require adjustments.

👍 2
Mr. Savy 2020-09-11T04:29:39.374Z

has anyone dealt with a stale client? I'm not sure why it decided to start doing this. I've tried restarting everything.

Mr. Savy 2020-09-11T04:32:07.374400Z

oh this might be shadow-cljs, I'll ask them

2020-09-11T05:04:24.378Z

@tony.kay I notice the new sync tx processing is different, it appears faster, in a fast sequence of actions it shows a label that wasn't really visible before. However it seems the :event/saved doesn't get called unless I run another action, this is with the rad form machine so probably from uism/trigger-remote-mutation not functioning properly? It's a bit hard to tell what's going on now the log output is a bit lighter.

tony.kay 2020-09-11T05:30:26.379200Z

Could be I need to trigger one more render in some cases

tony.kay 2020-09-11T05:31:07.380200Z

But you're saying an event is just missed? That should not be

2020-09-11T06:22:21.387200Z

I'm not sure if I am doing something wrong with uism use in general. I'm currently running into issues I can't explain with state-machines, not related to this sync tx. Had similar things a couple months back, thought I fixed my understanding now but sometimes still seeing some odd stuff, might be my mistake though. I'm not sure where to begin! my state-machines. A natural place to start many of them would be in an event handler of a different state-machine, but that gets called on the app and not the this/env. I'm afraid that might be tripping up the event queue or something?

2020-09-11T07:37:31.391200Z

different topic: maybe the default api-middleware writer could be UTF-8? Since I deal with Korean text a lot I have this line https://github.com/fulcrologic/fulcro/blob/develop/src/main/com/fulcrologic/fulcro/server/api_middleware.clj#L152" changed to

ret  (.toString baos "UTF-8")
so it returns properly formatted chars. I guess it's possible to supply my own wrap-transit-params but wondering if it isn't just good practice to have the writer be UTF-8 in general.

💯 1
2020-09-13T11:27:59.444900Z

Ah, interesting! Thanks for the background info.

Björn Ebbinghaus 2020-09-11T08:12:40.393500Z

Hey, I have started to use the hook support. When I add :use-hooks true to my Root component the initial-state is merged into the DB each time I change code and shadow-cljs refreshes. Should a Root component use hooks?

Helins 2020-09-11T12:05:50.395400Z

Is there some tool somewhere to provide time travel without relying on Inspect? That is, without resorting to ser/de. I find it gradually harder and harder to work like that, too much restrictions (no sorted collections, no fn when it would really make sense, and so one)

2020-09-11T14:08:36.396100Z

Can computed props not be used as part of an ident?

2020-09-11T14:35:30.398600Z

Are there any best practices around deriving ident values from parents of nested entities/components? I'm using the form state machinery and the components need :idents defined, but some of the forms are editing nested data that doesn't have an identity, e.g. the address in a user entity {:user/id 123 :user/address {:address/city ...}}

2020-09-11T14:35:58.399100Z

In this case, the user/id would suffice as part of an identity like [:address/id 123]

tony.kay 2020-09-11T15:40:01.400100Z

@mroerni I don’t think your problem is hooks. I suspect you’ve configured shadow to call the wrong startup function and are recreating your app every time, or forgot to use defone, etc.

tony.kay 2020-09-11T15:42:09.402100Z

@adam678 so, there’s >tap in shadow-cljs, which is nice, but serial. The other option is to add a hook of your own where you could track your own history in an atom, then just use the repl to look at it. You could put that in a render-listener (app config option), plug it in at submit-transaction! (another app option), etc.

tony.kay 2020-09-11T15:42:54.402800Z

The new db explorer tab in Inspect was built to address some of those isses. The db tab itself is hard to nav since it renders everything…

tony.kay 2020-09-11T15:45:36.405Z

@solussd correct. computed is for rendering, not for state. A component could be used in diff contexts (parents). The answer you’re looking for: You have to pre-populate the state before you try to render it. RAD uses UISM to do the control steps including creating “templates” of new children. You could have a look at that. dyn. Routing’s will-enter is a decent place to start if you’re getting there via a route.

👍 2
tony.kay 2020-09-11T15:46:36.406300Z

but pre-merge is good if you’re pulling one thing from the net and wanting another to be initialized….though I generally recommend using UISM these days for forms…there’s just a lot going on…and I’ve already written than generalized SM for you…it’s in RAD 🙂

2020-09-11T15:46:54.406500Z

Cool, thanks!

2020-09-11T16:33:08.409100Z

No more weirdness on my uisms, figured out my problems. But do still have the issue I mentioned when trying the stx/sync-tx! after going to :state/saving there's no progress until I try to go back and cancel (which it can't because I don't have a cancel event for :state/saving ). So it does sound like something like "need to trigger one more render"?

Jakub Holý 2020-09-11T20:48:53.410200Z

I have finally finished my "Error handling in Fulcro: 3 approaches". Thanks to Tony for his invaluable criticism and advice (and for Fulcro!).

🎉 3
Jakub Holý 2020-09-12T07:22:52.418300Z

Thank you! Let me check...

Jakub Holý 2020-09-12T07:27:43.418500Z

It seems you are right, thank you!

👍 1
tony.kay 2020-09-11T21:15:16.410800Z

@bbss I want to do more testing. This is happening in something like the RAD demo? I’ll have a look.

2020-09-11T21:18:18.410900Z

This looks great @holyjak! Look forward to reading all the way through. Minor nitpick: shouldn't it be ::p/errors, not ::pc/errors? (Assuming p aliases pathom.core and pc aliases pathom.connect, as is usual in the pathom docs.

tony.kay 2020-09-11T21:32:24.411100Z

So, the default in the JVM for that is UTF8, and a system property (file.encoding) controls that default. (See java.nio.charset.Charset.class, line 245). That said, I agree that webapps in general should be using UTF-8, and personally have no problem setting it in this middleware. If someone really wants a different encoding, it is trivial to copy/paste that little bit of code and do so.

tony.kay 2020-09-11T21:33:01.411300Z

I’m guessing you’re getting different because you’re setting something on the platform that the JVM pays attention to.

tony.kay 2020-09-11T21:47:20.411500Z

But I’ll patch FUlcro proper…UTF-8 is my intention

tony.kay 2020-09-11T23:19:10.416800Z

I can reproduce issues…I’ll look into it