-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Open
Labels
[Feature] Interactivity APIAPI to add frontend interactivity to blocks.API to add frontend interactivity to blocks.[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Description
The withScope() utility used in the Interactivity API (internally) silently eats up the errors thrown by the store functions at bunch of places including here:
gutenberg/packages/interactivity/src/utils.ts
Lines 187 to 192 in 6f1d4e2
| try { | |
| return func( ...args ); | |
| } finally { | |
| resetNamespace(); | |
| resetScope(); | |
| } |
Due to this, the errors never reach the console and left unaddressed. It's hard to debug issues that don't show up in the console. I was only able to find the bug after enabling the Pause on caught exceptions in the debugger. This catches a lot of noisy errors but at least it highlighted the real issue.
Step-by-step reproduction instructions
- Create a store with a getter with an undefined variable access.
- Use the getter for a directive on an element:
<div data-wp-class--hidden="state.isHidden">...</div>
Screenshots, screen recording, code snippet
Environment info
No response
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure
Metadata
Metadata
Assignees
Labels
[Feature] Interactivity APIAPI to add frontend interactivity to blocks.API to add frontend interactivity to blocks.[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended