샘플
react 19.0.0: useDeferredValue
검증된 샘플 — npm react 19.0.0: useDeferredValue. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: react package.json exports useDeferredValue and…
sha256:86a9448a6582db4e03bd2e69d517d87955ac77cd3c92ddeb444fbba7f290cddb
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-29 |
케이스
HOW- 목표
- verify useDeferredValue in pkg:npm/react@19.0.0
- 패키지
- 심벌
-
- useDeferredValue
- 환경
- node 22.23.2
- 생성일
- 2026-08-29T14:49:28Z
컨트랙트
- react package.json exports useDeferredValue and version 19.0.0
- react exports useDeferredValue as a function matching the named and default exports
- useDeferredValue throws an invalid hook call error when invoked outside component rendering context
- useDeferredValue delegates value and initialValue to the active hook dispatcher
- useDeferredValue supports single-argument invocation passing undefined as initialValue to the dispatcher
- SearchResults component executes useDeferredValue inside custom dispatcher and renders React element
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
소스
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify useDeferredValue in pkg:npm/react@19.0.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/react@19.0.0
Demonstrate these symbols/APIs:
- useDeferredValue
Required runtime conditions:
- ecosystem: golang
- language: go
- packageManager: go@1.26.6
- runtime: go@1.26.6
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:e3289e06a180139ffcf21dacfe8052d5c28c26c8727d10a25b2cfdae23389286","contract":["react package.json exports useDeferredValue and version 19.0.0","react exports useDeferredValue as a function matching the named and default exports","useDeferredValue throws an invalid hook call error when invoked outside component rendering context","useDeferredValue delegates value and initialValue to the active hook dispatcher","useDeferredValue supports single-argument invocation passing undefined as initialValue to the dispatcher","SearchResults component executes useDeferredValue inside custom dispatcher and renders React element"],"goal":"verify useDeferredValue in pkg:npm/react@19.0.0","kind":"HOW","packages":["pkg:npm/react@19.0.0"],"schemaVersion":1,"symbols":["useDeferredValue"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/react@19.0.0"],"schemaVersion":1,"subject":"pkg:npm/react@19.0.0","symbols":["useDeferredValue"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-react-use-deferred-value",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-react-use-deferred-value",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"react": "19.0.0"
}
},
"node_modules/react": {
"version": "19.0.0",
"resolved": "https://registry.npmjs.org/react/-/react-19.0.0.tgz",
"integrity": "sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
}
}
}
{
"name": "sample-react-use-deferred-value",
"version": "1.0.0",
"type": "module",
"private": true,
"license": "MIT-0",
"dependencies": {
"react": "19.0.0"
}
}
{
"schemaVersion": 1,
"goal": "verify useDeferredValue in pkg:npm/react@19.0.0",
"kind": "HOW",
"packages": [
"pkg:npm/react@19.0.0"
],
"symbols": [
"useDeferredValue"
],
"runtimeConditions": {
"ecosystem": "golang",
"language": "go",
"packageManager": "go@1.26.6",
"runtime": "go@1.26.6"
}
}
import React, { useDeferredValue } from 'react';
/**
* Component demonstrating useDeferredValue for deferring a search query update.
*
* @param {object} props
* @param {string} props.query - Current search query.
* @param {string} [props.initialQuery] - Optional initial deferred value for first render in React 19.
* @returns {object} React element with deferred query value.
*/
export function SearchResults({ query, initialQuery }) {
const deferredQuery = useDeferredValue(query, initialQuery);
return React.createElement('div', { 'data-deferred': deferredQuery }, deferredQuery);
}
/**
* Runs a hook function within a custom dispatcher context.
*
* @param {Function} callback - Function executing hook calls.
* @param {object} dispatcher - Custom React dispatcher implementation.
* @returns {any} Result of callback.
*/
export function withCustomDispatcher(callback, dispatcher) {
const internals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
const previousDispatcher = internals.H;
try {
internals.H = dispatcher;
return callback();
} finally {
internals.H = previousDispatcher;
}
}
import assert from 'node:assert/strict';
import fs from 'node:fs';
import { createRequire } from 'node:module';
import React, { useDeferredValue } from 'react';
import { SearchResults, withCustomDispatcher } from '../src/index.js';
const require = createRequire(import.meta.url);
// Contract 1: react package.json exports useDeferredValue and version 19.0.0
{
const pkgJsonPath = require.resolve('react/package.json');
assert.ok(fs.existsSync(pkgJsonPath));
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
assert.strictEqual(pkgJson.name, 'react');
assert.strictEqual(pkgJson.version, '19.0.0');
assert.strictEqual(pkgJson.exports['.']['default'], './index.js');
}
// Contract 2: react exports useDeferredValue as a function matching the named and default exports
{
assert.strictEqual(React.version, '19.0.0');
assert.strictEqual(typeof React.useDeferredValue, 'function');
assert.strictEqual(typeof useDeferredValue, 'function');
assert.strictEqual(React.useDeferredValue, useDeferredValue);
}
// Contract 3: useDeferredValue throws an invalid hook call error when invoked outside component rendering context
{
assert.throws(
() => {
useDeferredValue('test-value');
},
{
name: 'TypeError',
message: /Cannot read properties of null/
}
);
}
// Contract 4: useDeferredValue delegates value and initialValue to the active hook dispatcher
{
let recordedCall = null;
const mockDispatcher = {
useDeferredValue(value, initialValue) {
recordedCall = { value, initialValue };
return initialValue !== undefined ? initialValue : value;
}
};
const result = withCustomDispatcher(() => {
return useDeferredValue('updated-term', 'initial-term');
}, mockDispatcher);
assert.deepStrictEqual(recordedCall, {
value: 'updated-term',
initialValue: 'initial-term'
});
assert.strictEqual(result, 'initial-term');
}
// Contract 5: useDeferredValue supports single-argument invocation passing undefined as initialValue to the dispatcher
{
let recordedCall = null;
const mockDispatcher = {
useDeferredValue(value, initialValue) {
recordedCall = { value, initialValue };
return value;
}
};
const result = withCustomDispatcher(() => {
return useDeferredValue('current-input');
}, mockDispatcher);
assert.deepStrictEqual(recordedCall, {
value: 'current-input',
initialValue: undefined
});
assert.strictEqual(result, 'current-input');
}
// Contract 6: SearchResults component executes useDeferredValue inside custom dispatcher and renders React element
{
const mockDispatcher = {
useDeferredValue(value, initialValue) {
return initialValue || value;
}
};
const rendered = withCustomDispatcher(() => {
return SearchResults({ query: 'deferred-search', initialQuery: 'placeholder' });
}, mockDispatcher);
assert.strictEqual(React.isValidElement(rendered), true);
assert.strictEqual(rendered.type, 'div');
assert.strictEqual(rendered.props['data-deferred'], 'placeholder');
assert.strictEqual(rendered.props.children, 'placeholder');
}
console.log('All useDeferredValue contract tests passed.');
오리진 시더
익명