From 65e3a52a39696c1bd62d7c641492bd417afd8857 Mon Sep 17 00:00:00 2001 From: Daniel Lu Date: Tue, 19 Nov 2024 16:33:39 -0800 Subject: [PATCH] Improve error message for missing Provider error (#7404) --- packages/@react-spectrum/provider/src/Provider.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/@react-spectrum/provider/src/Provider.tsx b/packages/@react-spectrum/provider/src/Provider.tsx index f86a7f64c07..a8b97ec0d38 100644 --- a/packages/@react-spectrum/provider/src/Provider.tsx +++ b/packages/@react-spectrum/provider/src/Provider.tsx @@ -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 . ' + + '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; }