pmndrs / react-three-fiber

🇨🇭 A React renderer for Three.js
https://docs.pmnd.rs/react-three-fiber
MIT License
27.62k stars 1.6k forks source link

feat: add flushSync API #3308

Closed darrinm closed 3 months ago

darrinm commented 4 months ago

Add a flushSync R3F API to do the same thing as the react-dom flushSync API. Which is to synchronously and immediately render by boosting the priority of changes that occur within the passed callback function.

See https://react.dev/reference/react-dom/flushSync.

Because of its potential performance impact flushSync is a "last resort" option when one must synchronize R3F rendering with something else, e.g. DOM changes.

codesandbox-ci[bot] commented 4 months ago

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 71c4ee49a578cd7b7ca745dd973fc28654166d4a:

Sandbox Source
example Configuration