[]previous and next page

withoutClaiming

Runs fn with claiming switched off, so the templates it builds are created fresh instead of claimed from the server markup.

Runs fn with claiming switched off, so the templates it builds are created fresh instead of claimed from the server markup. Use it for content the server did not render (a portal the server sent nothing for), so its keys are not reported as missing. The previous state is restored when fn returns or throws.

Import#

ts
import { withoutClaiming } from "@shadow-js/web/extend";

Signature#

ts
function withoutClaiming<T>(fn: () => T): T

Parameters#

Name Description
fn The code to run. It runs synchronously, once.

Returns#

What fn returns. An error fn throws propagates.

Examples#

ts
import { template } from "@shadow-js/web";
import { withoutClaiming } from "@shadow-js/web/extend";

const makeTip = template(`<div class="tip"></div>`);
const tip = withoutClaiming(() => makeTip()); // a fresh clone, even during hydrate()