Fork me on GitHub
#fulcro
<
2018-11-16
>
claudiu06:11:16

@tony.kay Silly question, but can't put my finger on the internals. m/set-value requires a component, also transact! & df/load have logic for refreshing the ui if I send a component (as far as I can tell). If I'm in a static context but I have: component, it's intial state, reconciler, app-intial-state. Is there any way that I can generate a "component" that would work with those methods the same as if I would use it in the render with this ?

pvillegas1216:11:19

Can’t you pass in the reconciler?

claudiu21:11:18

yep sending reconciler works for transact! & load. But not for set-value! .

claudiu06:11:52

for the fulcro incubator defextended-defsc. would you be interested in a PR that updates the macro to take a third argument for extend "mandatory" ? Now it validates the implementation, what I would need for my mini-projects is to have 4-5 new keywords that are optional (like defsc).

tony.kay16:11:30

Sure, it’s incubator and that macro was mainly for you 😉

levitanong08:11:02

@tony.kay are there some known issues with state machines, aliases and deeply nested components? I’ve got an actor that has a component inside (so without denormalization, it has an ident as a property) and the aliases don’t seem to go past that ident.

tony.kay16:11:02

That is correct @levitanong: The state machine code expects actors to have properties at the moment, not children. If there is a normalized child, then it also needs to be a component. To-many relations are not yet implemented as well.

👌 4
levitanong08:11:58

If this is the case, then would it make sense to let plugins have access to a derefed version of the app state, so that manual denormalization can happen?

tony.kay16:11:18

And alias is to an ident/field.

tony.kay16:11:21

@claudiu if you’re writing library code you’ll often have to go beyond the simple public interface. set-value is one such case: It requires a component because it needs to calculate the ident…but that is convenience for the user in a particular context. Transact works with a reconciler, but all you get from using a component is refresh (which you can also get by adding the ident as a follow-on read)…so I think that is what you’re asking: how to refresh UI from reconciler???

afhammad19:11:39

Are there any talks/articles on fulcro from the community? (other than @tony.kay)

tony.kay21:11:11

You can also search for Untangled. There were articles written back when it was called that…for example on the AdStage blog (where they now use Fulcro). https://medium.com/adstage-engineering/tagged/untangled

claudiu20:11:17

@tony.kay nope I get that. It's not actually a problem, trying to understand the internals and if there is room for improving some things in the lib i'm trying to build

claudiu20:11:08

(defsc-route LibrariesPage [this props]
 {...
  :componentWillMount (fn []
                        ; both work
                        (m/set-value! this :test 1)
                        (df/load this :libraries Library {}))                        
  :before-enter    (fn [{:keys [::nav-router/reconciler] :as router-data}]
                        ; will not work
                        (m/set-value! this :test 1) 
                        (df/load this :libraries Library {})
                        
                        ;can be replaced with this
                        (df/load reconciler :libraries Library {}))}
  ...)

claudiu20:11:36

I get that this in the context of componentWillMount is different than the static one generated by defsc for :before-enter. But I was thinking if it's possible to make the this behave the same for df/load, transact! & m/set-value!.

claudiu20:11:26

So basically if i have: component + reconciler + initial state ... can I get something that would work like this with the fulcro state & network utils ?

pvillegas1221:11:22

Is there a way to do a load with (df/load ...) and not want to normalize? ie. not passing a component to df/load

claudiu21:11:24

have you tried with a component that just has query (no ident) ?

pvillegas1221:11:03

what would the query even be?

pvillegas1221:11:29

I just need the data blob to be placed in a specific target

pvillegas1221:11:02

I can do it with a mutation, but I would think using load would be better (from a semantics point of view)

claudiu21:11:21

ahh oky 🙂 got it 🙂 http://book.fulcrologic.com/#_the_ui_and_post_mutation the autocomplete stuff has something like that I think

(df/load component :autocomplete/airports nil {...}
`

tony.kay21:11:48

Yep. nil for the component.

pvillegas1222:11:34

facepalm that’s the first thing I tried and failed. Once I had everything working with a placeholder component, nil works

pvillegas1222:11:18

@tony.kay I have successfully removed the file middleware madness I was doing by removing the serial?: false, the api remote waits for the file remote to finish now