fix(core): wait for initial catalog readiness
This commit is contained in:
parent
e2faeb84e5
commit
e69f3af711
10 changed files with 616 additions and 70 deletions
|
|
@ -56,6 +56,26 @@ describe("State", () => {
|
|||
}),
|
||||
)
|
||||
|
||||
it.effect("runs committed after the rebuilt state is visible", () =>
|
||||
Effect.gen(function* () {
|
||||
let visible: string[] = []
|
||||
const state = State.create({
|
||||
initial: () => ({ values: [] as string[] }),
|
||||
draft: (draft) => ({ add: (item: string) => draft.values.push(item) }),
|
||||
committed: () =>
|
||||
Effect.sync(() => {
|
||||
visible = [...state.get().values]
|
||||
}),
|
||||
})
|
||||
|
||||
yield* state.transform((editor) => {
|
||||
editor.add("committed")
|
||||
})
|
||||
|
||||
expect(visible).toEqual(["committed"])
|
||||
}),
|
||||
)
|
||||
|
||||
it.effect("disposes a transform once and rebuilds remaining state", () =>
|
||||
Effect.gen(function* () {
|
||||
const state = State.create({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue