Major Changes
-
#1587
9e0bdf8Thanks @atrium-ladyx! -Mutationnow runs one call at a time per record, and the newConcurrentMutationhandles writes that overlap.Migration, step 1:
keyis now required, so every existingMutationfails to compile until you choose.key: falseif the mutation serves one record at a time, such as a single form. A second call while the first runs is ignored, not run.- A key function for per-row actions shared across rows, with the key type as the third type argument:
Mutation<Params, Data, number>({ key: ({ id }) => id, … }). With two type arguments, a key function fails with "No overload matches this call". ConcurrentMutationwhen every call carries a new value that must reach the server, such as a toggle that saves per click:concurrency: 'coalesce'(latest value wins, optionalmerge),'serial'(every call, in order), or'parallel'(independent calls). The closest equivalent of 2.0.2 behavior isConcurrentMutation({ concurrency: 'parallel', key: false, … }), but itsdata$has theConcurrentMutationStateshape.
Also changed:
- A keyed
Mutationexposesstatus$, aReadonlyMapof per-record results, instead ofdata$. Read records withstatus.get(key). reset$is replaced bydismiss$(anddismissAll$when keyed). Dismiss never returns a pending call to idle; its result still appears when it settles.- A call for a busy record is ignored: it is reported on the new
settled$stream asignored, callsonIgnoredif given, and warns in development otherwise. Disable the control while the record is pending. settled$emits one outcome per input (success,error,ignored;droppedforConcurrentMutation). Results and outcomes carryparams, keyed ones carrykey, and settled results carrysettledAt.- Repeated equal params each make a call; 2.0.2 suppressed equal consecutive params.
mutationFnreceives anAbortSignal, aborted only when the engine is disposed; a call that started is never aborted otherwise.onSuccessandonErrorreceive the params and the engine, and run directly after the outcome is delivered. Retry delays stop when a call or query is aborted.- With child engines, register shared mutations in the root engine at startup, for example
root.register(mutation.mutate$). Using one from a child engine before its parent is unsupported and warns in development. - Requires
@virtuoso.dev/reactive-engine-core^0.3.0.
Patch Changes
- Updated dependencies [
9e0bdf8]:- @virtuoso.dev/reactive-engine-core@0.3.0