Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Resolved conflicts by taking GitHub versions for: - .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml Kept deploy.sh updated to: - Pull from GitHub (primary source) - Push to Gitea (push-mirror) - Build from site/ directory (GitHub structure) Co-Authored-By: Paperclip <noreply@paperclip.ing>
32 lines
1.3 KiB
JavaScript
32 lines
1.3 KiB
JavaScript
/**
|
|
* Vary Params Decoding
|
|
*
|
|
* This module is shared between server and client.
|
|
*/ /**
|
|
* Synchronously reads vary params from a thenable.
|
|
*
|
|
* By the time this is called (client-side or in collectSegmentData), the
|
|
* thenable should already be fulfilled because the Flight stream has been
|
|
* fully received. We check the status synchronously to avoid unnecessary
|
|
* microtasks.
|
|
*
|
|
* Returns null if the thenable is still pending (which shouldn't happen in
|
|
* normal operation - it indicates the server failed to track vary params).
|
|
*/ export function readVaryParams(thenable) {
|
|
// Attach a no-op listener to force Flight to synchronously resolve the
|
|
// thenable. When a thenable arrives from the Flight stream, it may be in an
|
|
// intermediate 'resolved_model' state (data received but not unwrapped).
|
|
// Calling .then() triggers Flight to transition it to 'fulfilled', making
|
|
// the value available synchronously. React uses this same optimization
|
|
// internally to avoid unnecessary microtasks.
|
|
thenable.then(noop);
|
|
// If the thenable is still not 'fulfilled' after calling .then(), the server
|
|
// failed to resolve it before the stream ended. Treat as unknown.
|
|
if (thenable.status !== 'fulfilled') {
|
|
return null;
|
|
}
|
|
return thenable.value;
|
|
}
|
|
const noop = ()=>{};
|
|
|
|
//# sourceMappingURL=vary-params-decoding.js.map
|