@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
.
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
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
And yes clojure 1.9 and previous version of clojurescript work with keechma. Only the latest release causes issues (in the toolbox lib)
@urbank ^
Ah, I see. I thought that I was probably missing something. I'll check out that code again.
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
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
actually scratch that, wrong example
this is the correct one:
https://github.com/retro/confeedence/blob/master/src/cljs/confeedence/datasources.cljs#L15
so in this case access token datasource has the same strategy
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
there is a moment when user enters the access token, and we need to re-trigger the data loader
that happens here
(these is using the new forms library, but important to know is that this is basically the controller code)
so, you can manually tell data loader to re load it’s datasources
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
👌 Thanks!