[bug]: Erroneously throwing error #1986
Labels
needs: author response
Pending information from the author
status: actionable
Ready for work to begin
type: bug
Issue that causes incorrect or unexpected behavior
Description
We were getting :
Error: useBlocksTheme hook was called outside of context, make sure your app is wrapped with WordPressBlocksProvider
This simply wasn't the case. AS you can se from the
_app.js
A quick mental check told me I'd recently edited one line in here. Reverting that fixed this issue:
This was strange as in JS these should be practically the same.
Some code seleuthing quickly turned up:
faustjs/packages/blocks/src/components/WordPressBlocksProvider.tsx
Line 75 in e17d318
The use of
===
means we don't type castnull
to undefined even if it's practically the same. And allowingnull
to work whileundefined
doesn't.So, being the docs show a prolific use of
null
to no pass a theme butundefined
doesn't work, neither does simply not passing thetheme
in the config object. Seems like the fundamental issue here is we're checking for theWordPressBlocksProvider
based on the value oftheme
and not wether theWordPressBlocksContext
orWordPressThemeContext
are actually availableSteps to reproduce
See above
Additional context
related: #1844
@faustwp/core Version
3.1.0
@faustwp/cli Version
3.1.1
FaustWP Plugin Version
na
WordPress Version
na
Additional environment details
@faustwp/[email protected]
Please confirm that you have searched existing issues in the repo.
The text was updated successfully, but these errors were encountered: