Skip to content

WIP: fix(DnD): avoid unnecessary re-renders when drag modality changes. #8413

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 5 commits into
base: main
Choose a base branch
from

Conversation

reidbarber
Copy link
Member

@reidbarber reidbarber commented Jun 18, 2025

Closes #2504

Related #2403

Adds useDynamicDescription, an alternative to useDescription that reuses the description node and id to avoid excessive re-renders when the description text changes. Fixes the issue where changing drag modality causes all the drop targets on a page to re-render.

TODO: might need a mechanism to ensure shared elements aren't changed when another consumer still relies on the old text (not an issue for modality change, but might come up somewhere else).

TODO: Investigate why some tests are failing only in React 18

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

@reidbarber reidbarber changed the title feat: useDynamicDescription fix(DnD): avoid unnecessary re-renders when drag modality changes. Jun 18, 2025
@reidbarber reidbarber changed the title fix(DnD): avoid unnecessary re-renders when drag modality changes. WIP: fix(DnD): avoid unnecessary re-renders when drag modality changes. Jun 18, 2025
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.

useDrag re-renders from useDescription
1 participant