Skip to content

Commit 0493012

Browse files
committed
Returning theme context as this isn't required by the WordPressBlockProvider
1 parent 73f8a2f commit 0493012

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

packages/blocks/src/components/WordPressBlocksProvider.tsx

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,5 @@ export function WordPressBlocksProvider(props: {
6969
* ```
7070
*/
7171
export function useBlocksTheme(): BlocksTheme {
72-
// If it's an empty object, the provider hasn't been initialized.±
73-
if (
74-
typeof WordPressBlocksContext === 'undefined' ||
75-
typeof WordPressThemeContext === 'undefined'
76-
) {
77-
throw new Error(
78-
'useBlocksTheme hook was called outside of context, make sure your app is wrapped with WordPressBlocksProvider',
79-
);
80-
}
81-
82-
const themeContext = React.useContext(WordPressThemeContext);
83-
if (typeof themeContext === 'undefined') {
84-
throw new Error(
85-
'useBlocksTheme hook was called outside of context, make sure your app is wrapped with WordPressBlocksProvider',
86-
);
87-
}
88-
89-
return themeContext;
72+
return React.useContext(WordPressThemeContext);
9073
}

0 commit comments

Comments
 (0)