Skip to main content

Interface: HoleContext

Defined in: holes.types.ts:18

What the renderer tells a hole resolver about the field it is asking for. One of these reaches HoleResolver per hole per render, immediately before the block that reads that field is invoked.

Example

Route a hole to whichever source owns that field

import type { HoleContext } from "@nubbin/react";

const sourceFor = ({ block, path }: HoleContext) =>
block === "Price" && path === "amount" ? pricing : cms;

Properties

block

block: string

Defined in: holes.types.ts:32

The block's registered name — the same name the registry is keyed by.


nodeId

nodeId: string

Defined in: holes.types.ts:30

The id of the node whose field this is, stable across recompiles of the same document element. It is what the renderer stamps into data-nubbin-node, so a value traced in the browser leads back to the resolver call that produced it.


path

path: string

Defined in: holes.types.ts:37

The field, as the dotted schema path the block's ui.fields hint named it: amount, cta.label. The resolved value is written back at exactly this path.


route

route: string

Defined in: holes.types.ts:24

The route the artifact was compiled for, as artifact.route carries it. That is the pattern a param or prefix page was published at — /guides/[city], not the /guides/lisbon a request matched against it.


spec

spec: FieldHintData

Defined in: holes.types.ts:39

{ revalidate: n } — exactly what compile wrote into the artifact.