Skip to content

Commit

Permalink
fix(groupFilter): add dummy value to not crash PF select
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyperkid123 committed Jun 1, 2021
1 parent 568f0c6 commit a20a793
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 5 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion packages/components/src/ConditionalFilter/GroupFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,13 @@ class Group extends Component {
.filter(Boolean);

return (
<div key={groupId || groupValue || groupKey}>
/**
* DO NOT DELET THE EMPTY VALUE ON THE DIV ELEMENT
* If we delete it, it breaks the select filtering
* Here is the code that creates the runtime crash:
* https://github.com/patternfly/patternfly-react/blob/master/packages/react-core/src/components/Select/Select.tsx#L615
*/
<div key={groupId || groupValue || groupKey} value="">
{
groupSelectable && <SelectOption
onClick={ (event) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ exports[`Group - component render should render correctly placeholder 1`] = `
>
<div
key="0"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -369,6 +370,7 @@ exports[`Group - component render should render correctly placeholder 1`] = `
</div>
<div
key="second"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -442,6 +444,7 @@ exports[`Group - component render should render correctly placeholder 1`] = `
</div>
<div
key="third"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -517,6 +520,7 @@ exports[`Group - component render should render correctly placeholder 1`] = `
</div>
<div
key="3"
value=""
>
<SelectOption
className=""
Expand Down Expand Up @@ -657,6 +661,7 @@ exports[`Group - component render should render correctly with items - isDisable
>
<div
key="0"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -712,6 +717,7 @@ exports[`Group - component render should render correctly with items - isDisable
</div>
<div
key="second"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -785,6 +791,7 @@ exports[`Group - component render should render correctly with items - isDisable
</div>
<div
key="third"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -860,6 +867,7 @@ exports[`Group - component render should render correctly with items - isDisable
</div>
<div
key="3"
value=""
>
<SelectOption
className=""
Expand Down Expand Up @@ -1000,6 +1008,7 @@ exports[`Group - component render should render correctly with items 1`] = `
>
<div
key="0"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -1055,6 +1064,7 @@ exports[`Group - component render should render correctly with items 1`] = `
</div>
<div
key="second"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -1128,6 +1138,7 @@ exports[`Group - component render should render correctly with items 1`] = `
</div>
<div
key="third"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -1203,6 +1214,7 @@ exports[`Group - component render should render correctly with items 1`] = `
</div>
<div
key="3"
value=""
>
<SelectOption
className=""
Expand Down Expand Up @@ -1343,6 +1355,7 @@ exports[`Group - component render should render correctly with items and default
>
<div
key="0"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -1398,6 +1411,7 @@ exports[`Group - component render should render correctly with items and default
</div>
<div
key="second"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -1471,6 +1485,7 @@ exports[`Group - component render should render correctly with items and default
</div>
<div
key="third"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -1546,6 +1561,7 @@ exports[`Group - component render should render correctly with items and default
</div>
<div
key="3"
value=""
>
<SelectOption
className=""
Expand Down Expand Up @@ -1686,6 +1702,7 @@ exports[`Group - component render should render correctly with items and selecte
>
<div
key="0"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -1741,6 +1758,7 @@ exports[`Group - component render should render correctly with items and selecte
</div>
<div
key="second"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -1814,6 +1832,7 @@ exports[`Group - component render should render correctly with items and selecte
</div>
<div
key="third"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -1889,6 +1908,7 @@ exports[`Group - component render should render correctly with items and selecte
</div>
<div
key="3"
value=""
>
<SelectOption
className=""
Expand Down Expand Up @@ -2029,6 +2049,7 @@ exports[`Group - component render show more should render correctly with items a
>
<div
key="0"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -2084,6 +2105,7 @@ exports[`Group - component render show more should render correctly with items a
</div>
<div
key="second"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -2157,6 +2179,7 @@ exports[`Group - component render show more should render correctly with items a
</div>
<div
key="third"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -2232,6 +2255,7 @@ exports[`Group - component render show more should render correctly with items a
</div>
<div
key="3"
value=""
>
<SelectOption
className=""
Expand Down Expand Up @@ -2387,6 +2411,7 @@ exports[`Group - component render show more should render correctly with items a
>
<div
key="0"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -2442,6 +2467,7 @@ exports[`Group - component render show more should render correctly with items a
</div>
<div
key="second"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -2515,6 +2541,7 @@ exports[`Group - component render show more should render correctly with items a
</div>
<div
key="third"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -2590,6 +2617,7 @@ exports[`Group - component render show more should render correctly with items a
</div>
<div
key="3"
value=""
>
<SelectOption
className=""
Expand Down Expand Up @@ -2740,6 +2768,7 @@ exports[`Group - component render show more should render correctly with items a
>
<div
key="0"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -2795,6 +2824,7 @@ exports[`Group - component render show more should render correctly with items a
</div>
<div
key="second"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -2868,6 +2898,7 @@ exports[`Group - component render show more should render correctly with items a
</div>
<div
key="third"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -2943,6 +2974,7 @@ exports[`Group - component render show more should render correctly with items a
</div>
<div
key="3"
value=""
>
<SelectOption
className=""
Expand Down Expand Up @@ -3093,6 +3125,7 @@ exports[`Group - component render show more should render correctly with items a
>
<div
key="0"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -3148,6 +3181,7 @@ exports[`Group - component render show more should render correctly with items a
</div>
<div
key="second"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -3221,6 +3255,7 @@ exports[`Group - component render show more should render correctly with items a
</div>
<div
key="third"
value=""
>
<SelectGroup
className="pf-u-pl-sm"
Expand Down Expand Up @@ -3296,6 +3331,7 @@ exports[`Group - component render show more should render correctly with items a
</div>
<div
key="3"
value=""
>
<SelectOption
className=""
Expand Down

0 comments on commit a20a793

Please sign in to comment.