Skip to content

Scheduler detected unresolved dependencies v0.5.0 #813

@boyswan

Description

@boyswan
  • I've validated the bug against the latest version of DB packages

When trying to run an optimistic action on an electric collection, I get this error.

Uncaught Error: Scheduler detected unresolved dependencies for context 1efbf3e1-41e3-4201-9f42-da1f38ec6ae9.

This only seems to happen when mutating the draft object.

To Reproduce

const someCollection = createCollection(
  electricCollectionOptions({
   ...
  })
)

const testAction = createOptimisticAction<string>({
  onMutate: id => {
   someCollection.update(id, draft => {
      draft.name = 'new name here';
    });
  },
  mutationFn: async (id, _params) => {
    return { txid: 0 };
  }
});

...
testAction("1efbf3e1-41e3-4201-9f42-da1f38ec6ae9")

Disabling optimistic update prevents the error:

 someCollection.update(id, { optimistic: false }, draft => {
      draft.name = 'new name here';
    });

However this obviously defeats the point!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions