Skip to content

fix: context provider values not memoized #8578

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mohd-akram
Copy link

This prevents components being unnecessarily re-rendered.

✅ 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:

@mohd-akram mohd-akram force-pushed the fix-context-values branch from 6d9b61e to 8f94fdd Compare July 18, 2025 18:54
@devongovett
Copy link
Member

Do you have an actual performance issue here? I'd rather not litter the code with memoization unless there is clear evidence of a perf issue that's actually caused by it.

@mohd-akram
Copy link
Author

This is motivated by poor performance in Insomnia, which uses this library. Memoization of context values is IMO a correctness issue as much as it is a performance one (hence the lint). I will try to get some numbers. Is there any existing benchmark or demo that uses a large number of Spectrum components that I can use?

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