-
Notifications
You must be signed in to change notification settings - Fork 297
Closed
Description
Description
After upgrading to v3.9.4, I faced a major problem with my dropdown.
Steps to Reproduce
- Update to v3.9.4
- Create a Dropdown looking like this one :
(You can obviously use any bool condition instead ofhasRole)
<Dropdown
id="security-dropdown"
trigger={
<a href="#!">
Sécurité <Icon right>arrow_drop_down</Icon>
</a>
}>
{hasRole('ROLE_GUARDIAN') ? (
<>
<Link to={`/${userType}/email`}>Adresse Mail</Link>
<Link to={`/${userType}/other`}>Autre</Link>
</>
) : (
<Link to={`/${userType}/password`}>Mot de Passe</Link>
)}
</Dropdown>- Admire this beautiful error :
TypeError: (intermediate value).filter is not a functionlocated atrenderItems xxxxx/node_modules/react-materialize/lib/Dropdown.js:54
Expected behavior: Display correctly the dropdown as it was working in v3.9.3
Actual behavior: The temporary fix that I found is to make to separate conditions.
<Dropdown
id="security-dropdown"
trigger={
<a href="#!">
Sécurité <Icon right>arrow_drop_down</Icon>
</a>
}>
{hasRole('ROLE_GUARDIAN') && (
<Link to={`/${userType}/email`}>Adresse Mail</Link>
)}
{hasRole('ROLE_GUARDIAN') && (
<Link to={`/${userType}/other`}>Autre</Link>
)}
{!hasRole('ROLE_GUARDIAN') && (
<Link to={`/${userType}/password`}>Mot de Passe</Link>
)}
</Dropdown>Explanations : The PR #1164 made by @MauAbata changed the way Dropdowns are rendered, that had impact on my code, and I suppose and many others.
Versions
react-materialize: 3.9.4
materialize-css: 1.0.0
react: 17.0.1
Metadata
Metadata
Assignees
Labels
No labels
