Optional
canonFunc: () => voidThe function to run without any predictions applied. This will typically make authoritative changes to the data, based on a server response.
An optional list of predictions (as returned by applyPrediction
)
to undo. Typically, when a server response for a certain request is being handled,
you'd want to drop the prediction that was done for that request.
Temporarily revert all outstanding predictions, optionally run the provided function (which will generally make authoritative changes to the data based on a server response), and then attempt to reapply the predictions on top of the new canonical state, dropping any predictions that can no longer be applied cleanly (the data has been modified) or that were specified in
dropPredictions
.All of this is done such that redraws are only triggered if the overall effect is an actual change to an
Observable
.