Skip to content

Commit

Permalink
feat(rootNoCache): A new option to recall the root fetch if set to tr…
Browse files Browse the repository at this point in the history
…ue each time the referenceFetch

It is usefull for root fetch that takes parameters
  • Loading branch information
luc committed Oct 12, 2017
1 parent 79db13f commit e722e6d
Show file tree
Hide file tree
Showing 3 changed files with 3,791 additions and 989 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import referenceFetcher from 'reference-fetcher'
const configuration = {
entity: 'posts',
fetch: () => getPosts(),
rootNoCache: true,
refs: [{
entity: 'subreddit',
fetch: subredditId => getSubreddit(subredditId),
Expand Down Expand Up @@ -97,6 +98,7 @@ const getSubscribers = subscribersId => new Promise((resolve, reject) => {
* batch (Boolean): *Only for refs* Default value: false. Set to true if you want your `fetch`called only once with the array of ID to retrieve.
* optional (Boolean): *Only for refs* Default value: false. Set to true if the entity could not be in the object you fetched.
* noCache (Boolean): *Only for refs* Default value: false. Set to true if you want to bypass the already fetched watcher. It means that if the entity we want to retrieve was already retrieved earlier, ReferenceFetcher will still call our `fetch` with the unique IDs it finds in the parent `Object`.
* rootNoCache (Boolean): *Only for root* Default value: false. Set to true if you want to bypass the caching on the root fetch. It means that if we call our referenceFetcher with the same root fetch function, it will recall it each time we call the referenceFetcher.

### Returns
ReferenceFetcher returns nothing, its objective is only to correctly call the different Promises. We need to feed our store directly from the Promises.
Expand Down
Loading

0 comments on commit e722e6d

Please sign in to comment.