Backstop for a failed dynamic import, awaited by the app in its failure path: reloads the document
and resolves true only when the session is served a version other than the one this document runs,
so the app surfaces the error itself whenever this resolves false.
It takes no argument because a rejected import() exposes no HTTP status in any browser, so it asks
the hosting endpoint instead of guessing from the error. That one comparison covers both cases the
backstop exists for: a session that has moved to another version, and a pinned version directory
pruned away, which stops being honoured so that resolution falls back to the current version.
It bounds itself on the running document's stamp rather than on a flag: the stamp is stored in
sessionStorage before reloading and a reload happens only while the stored value differs from it. A
reloaded document carries a new stamp and so may recover again; a document that already reloaded
cannot loop, and nothing has to clear the entry. sessionStorage throws in some privacy modes, which
costs the bound rather than the reload.
Resolves false without reloading when this document carries no version stamp, when the endpoint
cannot be reached or does not answer with a well-formed 200, when the session is served the version
this document runs, and when this document already reloaded.
Backstop for a failed dynamic import, awaited by the app in its failure path: reloads the document and resolves
trueonly when the session is served a version other than the one this document runs, so the app surfaces the error itself whenever this resolvesfalse.It takes no argument because a rejected
import()exposes no HTTP status in any browser, so it asks the hosting endpoint instead of guessing from the error. That one comparison covers both cases the backstop exists for: a session that has moved to another version, and a pinned version directory pruned away, which stops being honoured so that resolution falls back to the current version.It bounds itself on the running document's stamp rather than on a flag: the stamp is stored in
sessionStoragebefore reloading and a reload happens only while the stored value differs from it. A reloaded document carries a new stamp and so may recover again; a document that already reloaded cannot loop, and nothing has to clear the entry.sessionStoragethrows in some privacy modes, which costs the bound rather than the reload.Resolves
falsewithout reloading when this document carries no version stamp, when the endpoint cannot be reached or does not answer with a well-formed200, when the session is served the version this document runs, and when this document already reloaded.