Fork me on GitHub
#fulcro
<
2020-04-27
>
tony.kay03:04:22

yeah, dynamic queries are a little tricky… I should have mentioned that earlier…it passed through my mind but I was in a hurry

dvingo14:04:48

No problem! it is also in the book so I should have been more careful checking against that too

Jakub Holý (HolyJak)16:04:56

@tony.kay Would you be interested in a PR to add a support for overriding the default formatter of a column based on its type, similarly as e.g. [:com.fulcrologic.rad.form/type->style->control :instant :default] can be used for a form? (I see it is currently hardcoded in com.fulcrologic.rad.report/formatted-column-value )

Jakub Holý (HolyJak)13:04:53

@tony.kay I have put together a draft of the change here https://github.com/fulcrologic/fulcro-rad/pull/33 - any comments? If not then I will go on to test it properly before removing the WIP marker. Thank you!

tony.kay16:04:35

looks pretty good…a few little touch-ups/adds to the SUI one

tony.kay16:04:57

@holyjak I am interested in solving the problem of defaults for that yes, and a PR would be great. You’re thinking of putting the lambda to do the formatting in the UI control map? That actually seems pretty reasonable, since you might want to return react elements.

👍 4
tony.kay16:04:40

have you thought about how that might also affect read-only elements in forms?

Jakub Holý (HolyJak)17:04:31

No, I haven't. You could expect that users want the same kind of data displayed in the same way in a report and a read-only field (yet be able to change that). On the other hand some "views" might perhaps be really tuned for a report and unsuitable for a form...

tony.kay16:04:19

at the moment I’m relying on the form inputs themselves to have a read-only mode…and I think that is probably right. What you’re dealing with is strictly reports

👍 4
tony.kay16:04:23

so I guess that is proper

Jakub Holý (HolyJak)17:04:20

Is :componentDidMount the right place to conditionally load-field! data of the component (excluded from the initial load! via :without) based on the values of some of its props? (imagine a Department component that only loads its Teachers if it isn't the dept of Secrecy)

lilactown17:04:54

what happens when it gets passed new props after mounting that should trigger the change?

Jakub Holý (HolyJak)19:04:38

Good point. But the props do not change so that is not an issue here. (If it was possible for them to change - would the load need to be in the will update lifecycle hook or....?)

lilactown19:04:38

did update probably

lilactown19:04:04

i would caution against programming in an assumption that props do not change

👍 4
Jakub Holý (HolyJak)20:04:41

I am trying to find out how to do this: I want to add a row action to a RAD report that fetches and displays some additional info in a popup. In normal Fulcro, the popup's query would be included in the parent's query and excluded from load! via :without . But I (think I) can't do that with the report. Can I load! the data to a well known location such as :current/details and have a link query [{[:current/details '_] [:details/info1 :details/more-info]}] in the popup component? It would effectively be outside the normal data tree, reading directly from the root DB...

tony.kay16:04:45

See the earlier comments on hooks and floating roots. Actually, hooks solves both of your last 2 questions better, and floating roots is nice for this last one…even has GC