Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add flushSync API #3308

Merged
merged 1 commit into from
Aug 10, 2024
Merged

Conversation

darrinm
Copy link
Contributor

@darrinm darrinm commented Jul 22, 2024

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.

Copy link

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

Sandbox Source
example Configuration

@CodyJasonBennett CodyJasonBennett merged commit 3802b53 into pmndrs:master Aug 10, 2024
2 checks passed
github-merge-queue bot pushed a commit to 3um-Group/3UM_Website that referenced this pull request Sep 12, 2024
![snyk-top-banner](https://github.com/andygongea/OWASP-Benchmark/assets/818805/c518c423-16fe-447e-b67f-ad5a49b5d123)

<h3>Snyk has created this PR to upgrade @react-three/fiber from 8.16.8
to 8.17.5.</h3>

:information_source: Keep your dependencies up-to-date. This makes it
easier to fix existing vulnerabilities and to more quickly identify and
fix newly disclosed vulnerabilities when they affect your project.

<hr/>

- The recommended version is **6 versions** ahead of your current
version.

- The recommended version was released on **22 days ago**.

<details>
<summary><b>Release notes</b></summary>
<br/>
  <details>
    <summary>Package name: <b>@react-three/fiber</b></summary>
    <ul>
      <li>
<b>8.17.5</b> - <a
href="https://github.com/pmndrs/react-three-fiber/releases/tag/v8.17.5">2024-08-10</a></br><p>Re-release
of 8.17.0 <a class="issue-link js-issue-link" data-error-text="Failed to
load title" data-id="2459038873" data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3331"
data-hovercard-type="issue"
data-hovercard-url="/pmndrs/react-three-fiber/issues/3331/hovercard"
href="https://github.com/pmndrs/react-three-fiber/issues/3331">#3331</a>.</p>
      </li>
      <li>
<b>8.17.4</b> - <a
href="https://github.com/pmndrs/react-three-fiber/releases/tag/v8.17.4">2024-08-10</a></br><p>Releases:<br>
@ react-three/[email protected]</p>
<p>[skip ci]</p>
      </li>
      <li>
<b>8.17.3</b> - <a
href="https://github.com/pmndrs/react-three-fiber/releases/tag/v8.17.3">2024-08-10</a></br><p>Releases:<br>
@ react-three/[email protected]</p>
<p>[skip ci]</p>
      </li>
      <li>
<b>8.17.2</b> - <a
href="https://github.com/pmndrs/react-three-fiber/releases/tag/v8.17.2">2024-08-10</a></br><p>Releases:<br>
@ react-three/[email protected]</p>
<p>[skip ci]</p>
      </li>
      <li>
<b>8.17.1</b> - <a
href="https://github.com/pmndrs/react-three-fiber/releases/tag/v8.17.1">2024-08-10</a></br><p>Releases:<br>
@ react-three/[email protected]</p>
<p>[skip ci]</p>
      </li>
      <li>
<b>8.17.0</b> - <a
href="https://github.com/pmndrs/react-three-fiber/releases/tag/v8.17.0">2024-08-10</a></br><h2>What's
Changed</h2>
<ul>
<li>feat: add flushSync API by <a class="user-mention notranslate"
data-hovercard-type="user" data-hovercard-url="/users/darrinm/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://github.com/darrinm">@ darrinm</a> in <a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="2423822581" data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3308"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3308/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3308">#3308</a></li>
<li>feat(native): implement native EventTarget methods by <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/CodyJasonBennett/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://github.com/CodyJasonBennett">@ CodyJasonBennett</a> in <a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="2279775241" data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3252"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3252/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3252">#3252</a></li>
<li>fix(native): inline use-measure for react-dom peerdep by <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/CodyJasonBennett/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://github.com/CodyJasonBennett">@ CodyJasonBennett</a> in <a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="2459020004" data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3323"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3323/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3323">#3323</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/darrinm/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://github.com/darrinm">@ darrinm</a> made their first
contribution in <a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="2423822581"
data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3308"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3308/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3308">#3308</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/arielmerinos/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://github.com/arielmerinos">@ arielmerinos</a> made their
first contribution in <a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="2326054859"
data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3275"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3275/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3275">#3275</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/Infonautica/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://github.com/Infonautica">@ Infonautica</a> made their first
contribution in <a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="2349113441"
data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3285"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3285/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3285">#3285</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/cwtuan/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self" href="https://github.com/cwtuan">@
cwtuan</a> made their first contribution in <a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="2277177651" data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3249"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3249/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3249">#3249</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a class="commit-link"
href="https://github.com/pmndrs/react-three-fiber/compare/v8.16.8...v8.17.0"><tt>v8.16.8...v8.17.0</tt></a></p>
      </li>
      <li>
<b>8.16.8</b> - <a
href="https://github.com/pmndrs/react-three-fiber/releases/tag/v8.16.8">2024-06-04</a></br><h2>What's
Changed</h2>
<ul>
<li>fix: update is.equ to compare booleans by <a class="user-mention
notranslate" data-hovercard-type="user"
data-hovercard-url="/users/AVAVT/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self" href="https://github.com/AVAVT">@
AVAVT</a> in <a class="issue-link js-issue-link" data-error-text="Failed
to load title" data-id="2333164135" data-permission-text="Title is
private"
data-url="pmndrs/react-three-fiber#3278"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3278/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3278">#3278</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/AVAVT/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self" href="https://github.com/AVAVT">@
AVAVT</a> made their first contribution in <a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="2333164135" data-permission-text="Title is private"
data-url="pmndrs/react-three-fiber#3278"
data-hovercard-type="pull_request"
data-hovercard-url="/pmndrs/react-three-fiber/pull/3278/hovercard"
href="https://github.com/pmndrs/react-three-fiber/pull/3278">#3278</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a class="commit-link"
href="https://github.com/pmndrs/react-three-fiber/compare/v8.16.7...v8.16.8"><tt>v8.16.7...v8.16.8</tt></a></p>
      </li>
    </ul>
from <a
href="https://github.com/pmndrs/react-three-fiber/releases">@react-three/fiber
GitHub release notes</a>
  </details>
</details>

---

> [!IMPORTANT]
>
> - Check the changes in this PR to ensure they won't cause issues with
your project.
> - This PR was automatically created by Snyk using the credentials of a
real user.

---

**Note:** _You are seeing this because you or someone else with access
to this repository has authorized Snyk to open upgrade PRs._

**For more information:** <img
src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiJlYmIzMjBhZS05M2NkLTQ0MjAtYTliZS00ZDZkY2IwN2YzMDEiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6ImViYjMyMGFlLTkzY2QtNDQyMC1hOWJlLTRkNmRjYjA3ZjMwMSJ9fQ=="
width="0" height="0"/>

> - 🧐 [View latest project
report](https://app.snyk.io/org/3um-group/project/9553dc1c-e7c4-4a83-81ea-024571aa73a5?utm_source&#x3D;github-cloud-app&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 📜 [Customise PR
templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates)
> - 🛠 [Adjust upgrade PR
settings](https://app.snyk.io/org/3um-group/project/9553dc1c-e7c4-4a83-81ea-024571aa73a5/settings/integration?utm_source&#x3D;github-cloud-app&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 🔕 [Ignore this dependency or unsubscribe from future upgrade
PRs](https://app.snyk.io/org/3um-group/project/9553dc1c-e7c4-4a83-81ea-024571aa73a5/settings/integration?pkg&#x3D;&amp;utm_source&#x3D;github-cloud-app&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr#auto-dep-upgrades)

[//]: #
'snyk:metadata:{"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"","from":"react-three/fiber","to":"react-three/fiber"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"ebb320ae-93cd-4420-a9be-4d6dcb07f301","prPublicId":"ebb320ae-93cd-4420-a9be-4d6dcb07f301","packageManager":"npm","priorityScoreList":[],"projectPublicId":"9553dc1c-e7c4-4a83-81ea-024571aa73a5","projectUrl":"https://app.snyk.io/org/3um-group/project/9553dc1c-e7c4-4a83-81ea-024571aa73a5?utm_source=github-cloud-app&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":6,"publishedDate":"2024-08-10T15:49:39.242Z"},"vulns":[]}'
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.

2 participants