keechma

Keechma stack. Mention @U050986L9 or @U2J1PHYNM if you have any questions
urbank 2017-08-05T14:23:38.891130Z

@mihaelkonjevic IMO it would be nice to have a less opinionated merge logic for dataprovider apart from the :target field. It is elegant, and perhaps should be used most of the time, but perhaps there should be an option to provide a custom function which takes the current app-db and the fetched data and merges the fetched data into the app-db.

mihaelkonjevic 2017-08-05T14:26:49.906514Z

So, params fb gets it's dependencies data and it's previous value. This allows you to implement things like infinite scroll, where you append to collection all the time. Also, the loader fan gets full access to app-dub, so you can get the data you need there. It was important that params fn has no free access to app do so I can manage the dependency graph

mihaelkonjevic 2017-08-05T14:29:30.919106Z

Here you can see that API loader fn can accept a function that can be used to load the data from the app db instead of doing the http call

mihaelkonjevic 2017-08-05T14:30:43.925986Z

And yes clojure 1.9 and previous version of clojurescript work with keechma. Only the latest release causes issues (in the toolbox lib)

mihaelkonjevic 2017-08-05T14:30:51.926684Z

@urbank ^

urbank 2017-08-05T14:31:56.932165Z

Ah, I see. I thought that I was probably missing something. I'll check out that code again.

mihaelkonjevic 2017-08-05T14:35:13.948038Z

Oh and another thing, if you have some special use cases you can still manually manage some parts of your app db, and depend on them from dataloader. Checkout this https://github.com/gothinkster/clojurescript-keechma-realworld-example-app/blob/master/src/cljs/realworld/datasources.cljs#L46

mihaelkonjevic 2017-08-05T14:36:00.952066Z

Jwt data source is ignored when the data is in app db. When it's not it tries to load the jwt from the local storage

mihaelkonjevic 2017-08-05T14:39:26.968575Z

actually scratch that, wrong example

mihaelkonjevic 2017-08-05T14:40:03.971689Z

this is the correct one:

mihaelkonjevic 2017-08-05T14:40:18.973158Z

so in this case access token datasource has the same strategy

mihaelkonjevic 2017-08-05T14:40:41.975364Z

tries to load it from the local storage if it exists, but it doesn’t reload it if it’s already in the app-db

mihaelkonjevic 2017-08-05T14:41:09.977692Z

there is a moment when user enters the access token, and we need to re-trigger the data loader

mihaelkonjevic 2017-08-05T14:41:21.978665Z

that happens here

mihaelkonjevic 2017-08-05T14:41:44.980725Z

(these is using the new forms library, but important to know is that this is basically the controller code)

mihaelkonjevic 2017-08-05T14:42:09.982747Z

so, you can manually tell data loader to re load it’s datasources

mihaelkonjevic 2017-08-05T14:43:00.987110Z

so if you have a special data source that has some convoluted logic, you can implement it in a controller, and still use the data loader for the rest of the app

urbank 2017-08-05T14:44:06.992343Z

👌 Thanks!