CodeSampleX

Exemple

react 19.2.8: Mount a React 19 client root with a synchronously committed context-aware portal and handle its event and unmount boundaries

Échantillon vérifié pour npm react 19.2.8: Mount a React 19 client root with a synchronously committed context-aware portal and handle its event and unmount…

sha256:ac9c6f7661fafad6db031b6eb109f10a581f711946c7eb8faf50c8c8101af4f7

Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré. Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes. MIT-0

Preuves d'exécution

L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.

Base de preuve
Contrat signé réussi
Reçus de vérification
2
Clés de signature qui l’ont compilé
2
Environnement déclaré node 24.13 windows amd64 node 24.13 javascript npm 11

Environnements des exécutions de vérification

Environnement Contrat Étapes Exécution
node 22 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1
2026-08-17
node 22 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1
2026-08-18

Cas

HOW
Objectif
Mount a React 19 client root with a synchronously committed context-aware portal and handle its event and unmount boundaries
Paquets
Symboles
  • react-dom/client.createRoot
  • react-dom.flushSync
  • react-dom.createPortal
  • react.createContext
  • react.useContext
Environnement
node 24.13.1
Créé
2026-08-17T02:01:43Z

Contrat

  1. createRoot is exported from react-dom/client and is absent from the react-dom root entrypoint
  2. flushSync around root.render commits the root DOM before flushSync returns
  3. createPortal places its child in a separate target while preserving context from its React ancestors
  4. a click from a portal child bubbles to its React ancestor despite separate DOM ancestry
  5. root.unmount synchronously removes both root and portal DOM
  6. root.render after root.unmount throws Cannot update an unmounted root

Fichiers

  • NOTES.md
  • csx.json
  • package-lock.json
  • package.json
  • src/index.mjs
  • test/contract.mjs

Télécharger l’artefact source (tar.gz)

Seeder d'origine

csx-seed