Skip to content

Commit

Permalink
Improve error message for missing Provider error (#7404)
Browse files Browse the repository at this point in the history
  • Loading branch information
LFDanLu authored Nov 20, 2024
1 parent 8217bd4 commit 65e3a52
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/@react-spectrum/provider/src/Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ const ProviderWrapper = React.forwardRef(function ProviderWrapper(props: Provide
export function useProvider() {
let context = useContext(Context);
if (!context) {
throw new Error('No root provider found.');
throw new Error(
'No root provider found, please make sure your app is wrapped within a <Provider>. ' +
'Alternatively, this issue may be caused by duplicate packages, see https://github.com/adobe/react-spectrum/wiki/Frequently-Asked-Questions-(FAQs)#why-are-there-errors-after-upgrading-a-react-spectrum-package for more information.'
);
}
return context;
}
Expand Down

1 comment on commit 65e3a52

@rspbot
Copy link

@rspbot rspbot commented on 65e3a52 Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.