1.4.2 RC 1 - Parallel optimistic
- 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