These are chat archives for orbitjs/orbit.js

Dec 2017
Oli Gustafsson
Dec 24 2017 07:09
Joram van den Boezem
Dec 24 2017 08:09
@morgler Good question, and I guess you're right. The project I originally developed the library for pre-caches most of its data and most of the time never makes a 'live' request (apart from updating). For that use case, querying the cache makes sense, and whenever I do need a live request, I use queryStore. It's probably better to use the standard Orbit.js store.query interface by default and make it optional to use store.cache.query.
Joram van den Boezem
Dec 24 2017 08:17

I thought about this before and couldn't really think of a good way to implement this in the configuration returned from mapRecordsToProps. Maybe something like this:

const mapRecordsToProps = {
  moons: q => q.findRecords("moon"), // Uses store.query by default, or store.cache.query if DataProvider.prop.cached is set to true
  planets: {cached: q => q.findRecords("planet")},
  asteroids: {live: q => q.findRecords("asteroid")},

with a new prop added to DataProvider like this:

<DataProvider dataStore={store} cached={true}/>
Joram van den Boezem
Dec 24 2017 08:49
Created issue for this here: exivity/react-orbitjs#4