Skip to content

Commit

Permalink
Merge pull request #299 from automerge/use-documents-fix-react-act-wa…
Browse files Browse the repository at this point in the history
…rnings

Fix React warnings in `useDocuments` tests
  • Loading branch information
pvh authored Mar 1, 2024
2 parents 8bcba03 + a421656 commit bf4c02c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/automerge-repo-react-hooks/test/useDocuments.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ describe("useDocuments", () => {
documentIds.forEach((id, i) => expect(documents[id]).toEqual({ foo: i }))
})

// multiply the value of foo in each document by 10
documentIds.forEach(id => {
const handle = repo.find(id)
handle.change(s => (s.foo *= 10))
act(() => {
// multiply the value of foo in each document by 10
documentIds.forEach(id => {
const handle = repo.find(id)
handle.change(s => (s.foo *= 10))
})
})

await waitFor(() => {
Expand Down

0 comments on commit bf4c02c

Please sign in to comment.