Skip to content

Commit

Permalink
Returning theme context as this isn't required by the WordPressBlockP…
Browse files Browse the repository at this point in the history
…rovider
  • Loading branch information
colinmurphy committed Dec 24, 2024
1 parent 73f8a2f commit 0493012
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions packages/blocks/src/components/WordPressBlocksProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,5 @@ export function WordPressBlocksProvider(props: {
* ```
*/
export function useBlocksTheme(): BlocksTheme {
// If it's an empty object, the provider hasn't been initialized.±
if (
typeof WordPressBlocksContext === 'undefined' ||
typeof WordPressThemeContext === 'undefined'
) {
throw new Error(
'useBlocksTheme hook was called outside of context, make sure your app is wrapped with WordPressBlocksProvider',
);
}

const themeContext = React.useContext(WordPressThemeContext);
if (typeof themeContext === 'undefined') {
throw new Error(
'useBlocksTheme hook was called outside of context, make sure your app is wrapped with WordPressBlocksProvider',
);
}

return themeContext;
return React.useContext(WordPressThemeContext);
}

0 comments on commit 0493012

Please sign in to comment.