Skip to content

[codex] Fix async renderer configure race#3762

Open
raashish1601 wants to merge 1 commit into
pmndrs:masterfrom
raashish1601:codex/3752-async-gl-init-race
Open

[codex] Fix async renderer configure race#3762
raashish1601 wants to merge 1 commit into
pmndrs:masterfrom
raashish1601:codex/3752-async-gl-init-race

Conversation

@raashish1601
Copy link
Copy Markdown

Summary

Fixes #3752.

This caches the in-flight async renderer initialization inside createRoot.configure, so repeated configure calls while a WebGPU-style gl callback is still resolving reuse the same renderer setup instead of invoking gl multiple times. After the shared renderer resolves, configuration rereads current root state before continuing so the latest pending configure can apply the latest size.

A regression test covers two concurrent configure calls with an async gl callback and different sizes, asserting that gl is called once and the final store size comes from the latest configure call.

Validation

  • corepack yarn jest packages/fiber/tests/index.test.tsx --runInBand
  • corepack yarn prettier --check packages/fiber/src/core/renderer.tsx packages/fiber/tests/index.test.tsx
  • corepack yarn eslint packages/fiber/src/core/renderer.tsx packages/fiber/tests/index.test.tsx (passes with existing warning-only repo baseline)
  • corepack yarn typecheck
  • corepack yarn build
  • git diff --check

@codesandbox-ci
Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a23c940:

Sandbox Source
example Configuration

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data races when using WebGPU

1 participant