Skip to content

Commit

Permalink
set only returned model as state (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahgrant authored Jun 8, 2022
1 parent 4b08b0a commit cdc768a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions lib/resourcerer.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,7 @@ export const useResources = (getResources, props) => {
// https://stackoverflow.com/questions/48563650/
// does-react-keep-the-order-for-state-updates/48610973#48610973
ReactDOM.unstable_batchedUpdates(() => {
if (resources.filter(withoutPrefetch).length) {
setModels(modelAggregator(resources.filter(withoutPrefetch)));
}
setModels(modelAggregator([[name, config]]));

loaderDispatch({
type: LoadingStates.LOADED,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "resourcerer",
"version": "1.0.8",
"version": "1.0.9",
"repository": "github.com/noahgrant/resourcerer",
"description": "Declarative data-fetching and caching framework for React",
"keywords": [
Expand Down

0 comments on commit cdc768a

Please sign in to comment.