Fork me on GitHub

@mjmeintjes Ah, makes sense. I’m not sure if the messages to the non started controller should throw an exception or just be dropped. The exception is there to help in the development. There is no reason why it wouldn’t work in a different way


@mjmeintjes it also might make sense to do the event binding / unbinding in the controller layer. In cases like this I usually just send the element to the controller and then do the rest there. That way you could use the stop lifecycle function to cleanup the event handlers. It would be similar to this


That's sort of what I'm doing as well. But how do you get a reference to the element? I've been using the ref function provided by react/reagent to send the newly created element to the controller, and then handling event binding and unbinding in there. However that's the function that's giving the error, as react seems to call it after controller has been stopped. I'll investigate it a bit further and see if it might be a bug on my end. It might make sense to not throw an exception but just log it if the controller isn't started, as currently it means the the app needs a refresh if it happens. Or provide some means of check whether controller is running from ui.


@mjmeintjes interesting, I’ll have to try to reproduce it locally. What are the reagent and react versions you’re using?


[reagent "0.8.0-alpha2"]
with shadow-cljs.


I'll try to spend some time next weekend putting together a project that reproduces the problem.


@mihaelkonjevic I’m having some issues keeping forms, controllers, and dataloaders straight in my head. For example, I have a form which I want to prepopulate with data. Great, I can use an api call which returns a promise--except, I need say a customer ID as an arg to the call, and that customer ID is populated by a dataloader. Since the toolbox.forms.core get-data method receives app-db, I try (get-in app-db [:kv :customer-id]), but this is {:status :pending} and a value of nil.


I think I need the :deps functionality of dataloaders, but not sure how to access it in forms


you can use wait-dataloader-pipeline! to wait for the dataloader to finish before you get the data from the app-db


so I would load everything through the dataloader, and then just read the data from the app-db in the form


huh, thought for sure I’d tried that.


does pipeline! have to have [value app-db] as its args?


I think I did [_ app-db] because I wasn’t using value


whatever you put there will be used as arguments for the wrapper function after the pipeline! macro does it’s thing


so you should be able to use whatever - [_ app-db] should work just fine


Yeah it does work, guess I was impatient


Thanks, rereading that page helped.