Skip to content

Store.custom crash in production #693

@felipealmeidacorrea

Description

@felipealmeidacorrea

The issue originated in PR #683 involves an "Invalid Hook Call" error. This error occurs because the useIntl hook from the react-intl library was being called inside the getFilters function, which is not a React functional component or a custom Hook.

React hooks, including useIntl, must only be used within functional components or custom hooks as per the Rules of Hooks. Violating these rules leads to runtime errors, particularly during rendering, as observed in this case. This error affects both server-side rendering (SSR) and client-side rendering processes, causing application instability.

To Reproduce
Go to any page using a store.custom template that has productClusterIds as prop.

Expected behavior
It was supposed to show the products without the error mentioned

Screenshots

Image

Desktop environment:

Additional context
The error is located in lines 35 and 36 of the file react/utils/getFilters.js, where the useIntl hook is improperly called outside the context of a React functional component or custom hook.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions