Skip to content

fix: Environment with no FinalizationRegistry #7885

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

Merged
merged 2 commits into from
Mar 10, 2025

Conversation

snowystinger
Copy link
Member

@snowystinger snowystinger commented Mar 7, 2025

Closes #7882

We thought we could safely use this as every environment supports it
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
https://caniuse.com/?search=FinalizationRegistry

But it's not supported in CloudFlare workers or React Native. In that case though, every request should result in the complete throwing away of any previous request making the memory leak a non-issue.

If any other environments come along without this feature, they'll also have the problem, but given how long it took for it to be reported, maybe it's not that big of a deal.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@rspbot
Copy link

rspbot commented Mar 7, 2025

@snowystinger snowystinger enabled auto-merge March 10, 2025 20:08
@rspbot
Copy link

rspbot commented Mar 10, 2025

@snowystinger snowystinger added this pull request to the merge queue Mar 10, 2025
Merged via the queue into main with commit c71be09 Mar 10, 2025
30 checks passed
@snowystinger snowystinger deleted the fix-environment-with-no-finalizationregistry branch March 10, 2025 20:30
@tobimori
Copy link

tobimori commented May 6, 2025

Cloudflare Workers now has support for FinalizationRegistry:
https://developers.cloudflare.com/workers/configuration/compatibility-flags/#enable-finalizationregistry-and-weakref

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.

FinalizationRegistry in @react-aria/utils 3.28.0 is unsupported in Cloudflare Workers environment
5 participants