Skip to content

1.4.2 RC 1 - Parallel optimistic

Compare
Choose a tag to compare
@hazae41 hazae41 released this 16 Mar 21:23
· 596 commits to master since this release
  • Optimistic updates are now unlocked and can be executed in parallel
  • Optimistic updates are applied again when data is mutated while an optimistic block is pending
  • Optimistic updates must now be deterministic / pure / idempotent : they should give the same result when called multiple times with the same state
  • New syntax for optimistic updates:

BEFORE

document.update(async function* (previous) {
  yield { data: "hello world" } 
  yield { data: "it works" } 
})

NOW

document.update(async function* () {
  yield (previous) => ({ data: "hello world" })
  yield (previous) => ({ data: "it works" })
})

Basically, XSWR store those functions and apply them again when necessary