Function isDocumentLoadSupersededError
Function
Type Signature
isDocumentLoadSupersededError(error: unknown): boolean
Type Declaration
Parameters
errorunknownThe value a rejected NutrientViewer.Instance#load threw.
Returns
booleantruewhen a laterload()replaced this one before it started.Example
try {
await instance.load({ document: nextDocument });
} catch (error) {
if (NutrientViewer.isDocumentLoadSupersededError(error)) {
return; // A newer load() took over; it owns the outcome.
}
throw error;
}
Whether a rejected NutrientViewer.Instance#load was dropped in favour of a later
load()call on the same instance, without ever starting.Only the most recently requested document is worth loading, so when several calls queue up behind one that is already running, the ones still waiting are dropped rather than replayed one after another. Each dropped call rejects with an error this predicate recognises.
Nothing happened to the viewer: a superseded call never touched the document that was on screen, so NutrientViewer.isPreviousDocumentClosedError is
falsefor it. Treat it as "your request was replaced by your own newer one", which is normally not an error worth surfacing to a user.The call that superseded it is unaffected, and the load already in flight always runs to completion — a superseded call never cancels work that had started.