Skip to content

Commit

Permalink
update: updateStore forceUpdate is true by default
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-phan committed May 12, 2020
1 parent 3d5504c commit 8533238
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "global-state-hook",
"version": "1.5.0",
"version": "1.5.1",
"description": "Super tiny state sharing library with hooks",
"source": "src/index.ts",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function createSubscription<S extends any>(
const subscribe = (fn: Listener<S>) => listener.push(fn)
const unsubscribe = (fn: Listener<S>) =>
(listener = listener.filter((f) => f !== fn))
const updateState = (nextState: S, forceUpdate = false) => {
const updateState = (nextState: S, forceUpdate = true) => {
Object.assign(state, nextState)
forceUpdate && listener.forEach((fn) => fn(nextState))
}
Expand Down

0 comments on commit 8533238

Please sign in to comment.