Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove lix.settled() for awaiting the change queue in select from change #69

Open
samuelstroschein opened this issue Sep 3, 2024 — with Linear · 0 comments
Open

Comments

Copy link
Member

samuelstroschein commented Sep 3, 2024

Proposal

Remove settled() for awaiting the change queue in select queries to the change table.

Pros

  • glitch free behavior (because calling settled() is not forgotten)
  • decreased API surface

Cons

  • RxJS internally

Context

The need for lix.settled() doesn't exist if select queries to table that the change queue impacts are awaited while the queue is running.

// the query awaits the change queue
const changes = await lix.db.selectFrom("change").selectAll().execute()
// pseudocode kysely plugin that awaits an observable

async function interceptSelect(query){
  if (query.table === "change"){
    await state.changeQueueSettled
    return query
  }
} 
// the settled awaits the last emitted value of the change queue
state.changeQueueSettled = lastValueOf(state.changeQueue$)
@samuelstroschein samuelstroschein changed the title remove lix.settled() for awaiting select from change remove lix.settled() for awaiting the change queue in select from change Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant