Skip to content

Errors within the store are being eaten up by the Interactivity API #72683

@tusharsnx

Description

@tusharsnx

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:

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

  1. Create a store with a getter with an undefined variable access.
  2. Use the getter for a directive on an element: <div data-wp-class--hidden="state.isHidden">...</div>

Screenshots, screen recording, code snippet

Image

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

No one assigned

    Labels

    [Feature] Interactivity APIAPI to add frontend interactivity to blocks.[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions