Skip to content

Conversation

devongovett
Copy link
Member

@devongovett devongovett changed the title chore: RFC: Improving React Aria and React Spectrum dependency management chore: Dependency management RFC Aug 29, 2025
@vezaynk
Copy link

vezaynk commented Sep 9, 2025

The above changes mean that a significantly smaller number of dependencies will be installed when using react-aria-components and @react-spectrum/s2. These will be the remaining packages:

react-stately
react-aria
@internationalized/*
react-aria-components
@adobe/react-spectrum
@react-spectrum/s2

Inter-dependencies between these packages should have pinned versions. Duplication could still occur if different parts of an application depend on different versions, but the likelihood is significantly reduced. It will also be much easier to resolve when it occurs because there are fewer packages to coordinate.

My understanding is that for at least some of these (looking at react-stately in particular), version duplication wouldn't be a problem.

For everything else, I think we could see even less duplication by declaring them as peers with pinned versions.

If they are regular dependencies, then a consumer depending on both react-aria-components and react-aria needs to be careful what versions they specify because mistakes will lead to silent duplication, whereas with peer dependencies, the issue will be more visible.

@snow893
Copy link
Contributor

snow893 commented Sep 9, 2025

@devongovett With this change, we'll no longer need to add alpha/beta components as a dependency, right? Direct path should work as long as we have the correct monopackage dependency?

@devongovett
Copy link
Member Author

devongovett commented Sep 9, 2025

@vezaynk Yeah peer dependencies are a possibility, but it would add a bit of friction to the installation process at least with certain package managers. You'd need to manually install react-aria and react-stately into your project in addition to react-aria-components, even if you weren't using them directly. Also adding peer dependencies is generally a breaking change, so it would be harder to keep backward compatible.

Another possibility I mentioned in the RFC is merging all of those into a single mega-package, which would make using the hooks and components together easier as well. But this is a bit bigger of a change that perhaps we'd consider separately in the future.

@snow893 Correct, the alpha/beta components would be included in the mono-package with the UNSTABLE_ prefix.

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.

3 participants