Skip to content

Commit

Permalink
fix: delay update to next tick when dict is loaded.
Browse files Browse the repository at this point in the history
  • Loading branch information
schummar committed Nov 2, 2021
1 parent 30c79f5 commit c3e24e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ export class Store<D extends Dict = any> {
}

private notify() {
for (const sub of this.subs) sub();
setTimeout(() => {
for (const sub of this.subs) sub();
});
}
}
2 changes: 1 addition & 1 deletion test/react.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,6 @@ test('placeholder', async (t) => {
fireEvent.click(div);
t.is(div.textContent, '.......');

await wait(1);
await wait(2);
t.is(div.textContent, 'key1:de');
});

0 comments on commit c3e24e1

Please sign in to comment.