Skip to content

RFC: write an high-level API for trackDirtyCoValues #2806

@gdorsi

Description

@gdorsi

When writing server code without using the Jazz HTTP wrapper, one of the pain points is to use waitForSync

We could give a better experience writing an higher level API to do this

const worker = await getJazzWorker();

const node = worker._raw.core.node;
const tracking = node.syncManager.trackDirtyCoValues();

// [...] business logic

// For each CoValue changed during this invocation, ensure it has been synced.
await Promise.all(
  Array.from(tracking.done(), (id) => node.syncManager.waitForSync(id)),
);

Proposal:

const changes = Account.trackChangedCoValues(worker);

// [...] business logic

await changes.stopTracking().waitForSync();

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions