patternfly / patternfly-react

A set of React components for the PatternFly project.
https://react-staging.patternfly.org/
MIT License
797 stars 356 forks source link

Bug - [ToolbarFilter] - [chipGroupContentRef.current is null] #10857

Open ammont82 opened 3 months ago

ammont82 commented 3 months ago

Describe the problem Using component in other component raise chipGroupContentRef.current is null exception in some cases.

How do you reproduce the problem? Acess to this URL: https://console.redhat.com/openshift/assisted-installer/clusters and wait for a while. The error appears after some time.

Expected behavior Not error shown in the page.

Is this issue blocking you? Yes, I implement it a workaround to solve it: https://github.com/openshift-assisted/assisted-installer-ui/pull/2652/files#diff-9e34dbbb99bb6a4515f6f35e3ba200ac0d376f46e53f13f00ae66f777d1bd229 creating a CustomToolbarFilter component.

To solve this issue, if you go to https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/Toolbar/ToolbarFilter.tsx#L137 and add this piece of code, it works:

  {chipGroupContentRef &&
            chipGroupContentRef.current !== null &&
            chipGroupContentRef.current.firstElementChild !== null &&
            ReactDOM.createPortal(chipGroup, chipGroupContentRef.current.firstElementChild)}

Screenshots image

What is your environment?

What is your product and what release date are you targeting? I'm using patternfly/react-core 5.2.0

Any other information?

jgyselov commented 3 months ago

This might be a better screenshot of the error:

image

github-actions[bot] commented 3 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.