Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
.DS_Store
.DS_Store
package-lock.json
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"tiny-uuid": "^1.0.0"
},
"jest": {
"testURL": "http://localhost",
"setupFiles": [
"./tests/jest.setup.js"
],
Expand Down
4 changes: 2 additions & 2 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ export class Provider extends React.PureComponent {
let isFunc = typeof result === 'function'
if (isFunc) result = result(this.state)
if (result.then) {
return new Promise(res =>
return new Promise((res, rej) =>
Promise.resolve(result).then(state => {
// Update store
this.store.state = { ...this.store.state, ...state }
// Call subscribers
this.store.subscriptions.forEach(callback => callback(state))
// Update local state
this.setState(state, res)
})
}).catch(rej)
)
} else {
// Update store in sync
Expand Down