Skip to content

docs(docs-infra): guard sandbox reset before initialization in playground#68221

Open
erkamyaman wants to merge 1 commit intoangular:mainfrom
erkamyaman:fix/docs-infra-playground-sandbox-reset-guard
Open

docs(docs-infra): guard sandbox reset before initialization in playground#68221
erkamyaman wants to merge 1 commit intoangular:mainfrom
erkamyaman:fix/docs-infra-playground-sandbox-reset-guard

Conversation

@erkamyaman
Copy link
Copy Markdown
Contributor

docs(docs-infra): guard sandbox reset before initialization in playground

changeTemplate() was calling reset() on the sandbox before init() completed, causing a TypeError when spawning processes on an uninitialized WebContainer. Add isSandboxReady signal to skip reset until the sandbox is fully initialized.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

When the playground component initializes, an effect fires changeTemplate() which calls reset() on the NodeRuntimeSandbox before init() has completed. This causes a TypeError: Cannot read properties of undefined (reading 'spawn') because the WebContainer instance hasn't been created yet. This error is reproducible on angular.dev/playground in production.

image

Issue Number: N/A

What is the new behavior?

A isSandboxReady signal is added that is set to true only after init() completes. changeTemplate() now checks this signal before calling reset(), preventing the TypeError during initial load.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

…ound

changeTemplate() was calling reset() on the sandbox before init()
completed, causing a TypeError when spawning processes on an
uninitialized WebContainer. Add isSandboxReady signal to skip
reset until the sandbox is fully initialized.
@pullapprove pullapprove bot requested a review from kirjs April 15, 2026 16:24
@angular-robot angular-robot bot added area: docs Related to the documentation area: docs-infra Angular.dev application and infrastructure labels Apr 15, 2026
@ngbot ngbot bot added this to the Backlog milestone Apr 15, 2026
@erkamyaman
Copy link
Copy Markdown
Contributor Author

The error:

content_script_bundle.js:1 Attempting handshake with backend Wed Apr 15 2026 19:11:47 GMT+0300 (GMT+03:00)
chunk-DiUIYUXi.js:38 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'spawn')
at e.removeFiles (chunk-DiUIYUXi.js:38:2894)
at async e.cleanup (chunk-DiUIYUXi.js:38:2695)
at async e.reset (chunk-DiUIYUXi.js:37:5901)
at async t.changeTemplate (chunk-DfuSvvE0.js:1:2802)
blitz.4c73681d.js:19 [Contextify] [WARNING] running source code in new context
(anonymous) @ blitz.4c73681d.js:19
headless?version=1.6.1:1 The resource https://w-corp-staticblitz.com/fetch.worker.4c73681d.js was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate as value and it is preloaded intentionally.
chunk-DiUIYUXi.js:37 Load time: 60932.60009765625 ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adev: preview area: docs Related to the documentation area: docs-infra Angular.dev application and infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants