Fork me on GitHub
#fulcro
<
2020-04-17
>
tvaughan14:04:28

I had to allow third-party cookies to get it to work ¯\(ツ)

Frank Henard20:04:26

I'm working on storing a date in the Fulcro db. Does anyone remember where in the Fulcro Videos Tony talks about how to maintain the correct data type between the Clojure backend and the Clojurescript frontend?

Frank Henard20:04:16

I think he talks about the math namespace there, and discusses using Transit

nick14:04:50

Great find. Thanks for sharing!

👍 4
alex-eberts21:04:23

Hi All, I was having trouble explaining the idea of how Fulcro “composes” the UI from the database to a friend so I came up with the following explanation. Is this correct?:

alex-eberts21:04:24

Components form a tree with the Root component encapsulating all the other components. Each component is responsible for rendering one part of the sub-tree. To render the UI, the root component is handed a tree-representation of the application’s client-database (a.k.a. the application’s data). The root component picks out the data it needs and hands the rest of the data to its child components which in turn, pick out the data they need and hand the rest of the data to their children until all components in the chain are rendered. In this way, the UI is said to be “composed” from the root element.

mdhaney21:04:52

Not bad, but any description of Fulcro that doesn’t mention normalization is ignoring its single most compelling feature IMO.

☝️ 4
alex-eberts21:04:32

@mdhaney Thanks for the feedback… re: normalization - I avoided it on purpose so that I didn’t overwhelm the person with too many new concepts. The next step would be to explain how the database is structured and get into why normalization is so important etc…

mdhaney21:04:15

Makes sense.

lilactown22:04:03

is there a place in the docs that specifically talks about why normalization is so important?

lilactown22:04:21

sometimes it is easier to link someone to something than to explain it all to them (also I would like to read it)

alex-eberts22:04:24

@lilactown A good discussion is sections 3.8 and 3.9 of the Fulcro book: http://book.fulcrologic.com/#_updating_the_data_tree

lilactown22:04:55

great, thanks!

👍 4
tony.kay22:04:30

Interestingly, and I’m not sure when, Apollo has adopted normalization as well…the idea is definitely taking hold in the wider world

tony.kay22:04:25

which is funny, because we’ve been doing it in “real databases” for how many decades???? At least 6 or 7

lilactown22:04:51

I thought that was the major selling point for apollo? that it handles the complex caching of GraphQL queries

tony.kay22:04:12

caching yes, but I’m not sure when they added normalization…was it always there since release? I thought the earlier releases had caching, but it was subtrees.

tony.kay22:04:22

perhaps I just missed it

mss22:04:36

hey y’all, trying to debug a transact! call not triggering a re-render using the vanilla keyframe renderer. I have a parent component A, that renders a component B. B renders a modal C that is rendered via a portal. everything works fine and dandy until I navigate away from and back to this view. after navigating back, when calling transact! inside A to render B/C, the data is updated correctly in the db (i.e. modal should be rendered), but updated props are not being fed to B/C. I’ve attempted to add the idents for B and C into as :refresh options to the transact! call in A, but that’s not working either. if anyone has any ideas about how to debug this, I’d really appreciate the help

tony.kay22:04:17

you using the latest Fulcro @mss? And are you using tx helpers like toggle! ?

tony.kay22:04:57

the usual cause is that your query doesn’t include the thing you’re changing, so your component’s props are not changing, so the default shouldComponentUpdate is short-circuiting

tony.kay22:04:29

refresh will only fail to work w/keyframe if your props don’t actually change..

tony.kay22:04:52

but there is a “sort of” bug in very recent versions of Fulcro related to transact!!

mss22:04:58

shouldn’t that get fixed by adding the idents of whatever components need to be-re-rendered to the :refresh within the transact! call? on latest/3.2.2

tony.kay22:04:27

:refresh is completely useless on kf…it just renders from root

tony.kay22:04:36

shouldComponentUpdate compares real props. Period

tony.kay22:04:19

wouldn’t refresh with any renderer if you don’t change props…the :refresh option is a hint: I’d like you to send new props to the things…

tony.kay22:04:35

but if you don’t actually change props, then SCU will still say “no need”

mss22:04:47

when you say “change props”, do you mean not actually changing an entry in the db? because the db is def getting updated properly. the component with the ident at that table location just doesn’t seem to be getting fed the updated data. sorry if I’m misunderstanding here

Jakub Holý (HolyJak)07:04:58

The process is DB -query-> data tree -> props. You have already mentioned that the DB is updated properly so what else could be "wrong" is the query of B/C not asking for the changed data.