Brainstorming here, would it be worthwhile to explore a fetch-on-miss type functionality for memory source caches? Or would that be too difficult given sync vs. async, etc?
My current problem space is a React Native screen that might be navigated to, directly, or from a prior screen that might have already fetched the resource in question. So I have:
useEffect(() => {
const profileQuery = q => q.findRelatedRecord(props.introduction.relationships.initiator.data, 'dating_profile');
const profile = props.dataStore.cache.query(profileQuery);
// We may have navigated here directly...
if (profile) {
setProfile(profile);
}
else {
__DEV__ && console.log('Fetching profile');
props.dataStore.query(profileQuery)
.then(profile => setProfile(profile));
}
}, []);
Which is my approach at doing a manual fetch on cache miss... is it worth exploring something like this natively in Orbit?
Brainstorming here, would it be worthwhile to explore a fetch-on-miss type functionality for memory source caches? Or would that be too difficult given sync vs. async, etc?
My current problem space is a React Native screen that might be navigated to, directly, or from a prior screen that might have already fetched the resource in question. So I have:
Which is my approach at doing a manual fetch on cache miss... is it worth exploring something like this natively in Orbit?