Skip to content

Commit

Permalink
feat: mutate with
Browse files Browse the repository at this point in the history
  • Loading branch information
wobsoriano committed Jun 14, 2023
1 parent 7cef2cc commit d7ca098
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ export function share<T extends Store, K extends keyof T['$state']>(

externalUpdate = true;
timestamp = evt.timestamp;
store[key] = evt.state;
store.$patch((state: any) => {
state[key] = evt.state;
});
};

const sync = () => channel.postMessage(undefined);
Expand Down

0 comments on commit d7ca098

Please sign in to comment.