keechma

Keechma stack. Mention @U050986L9 or @U2J1PHYNM if you have any questions
mihaelkonjevic 2018-01-29T07:11:34.000215Z

@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

mihaelkonjevic 2018-01-29T07:23:02.000075Z

@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 https://github.com/keechma/example-place-my-order/blob/master/client/src/client/controllers/order_history.cljs

mjmeintjes 2018-01-29T08:04:13.000224Z

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.

mihaelkonjevic 2018-01-29T10:00:49.000270Z

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

mjmeintjes 2018-01-29T10:15:08.000388Z

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

mjmeintjes 2018-01-29T10:15:35.000234Z

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

sooheon 2018-01-29T15:14:47.000225Z

@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.

sooheon 2018-01-29T15:15:52.000248Z

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

mihaelkonjevic 2018-01-29T15:16:14.000667Z

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

mihaelkonjevic 2018-01-29T15:17:22.000064Z

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

sooheon 2018-01-29T15:17:29.000692Z

huh, thought for sure I’d tried that.

sooheon 2018-01-29T15:17:46.000150Z

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

sooheon 2018-01-29T15:17:59.000285Z

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

mihaelkonjevic 2018-01-29T15:18:40.000046Z

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

mihaelkonjevic 2018-01-29T15:19:58.000241Z

check here https://keechma.com/news/introducing-keechma-toolbox-part-1-pipelines/ - under “The implementation” subtitle

mihaelkonjevic 2018-01-29T15:20:37.000495Z

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

sooheon 2018-01-29T15:28:04.000073Z

Yeah it does work, guess I was impatient

sooheon 2018-01-29T15:29:27.000368Z

Thanks, rereading that page helped.