Skip to content

[Sidenav]: Mobile view does not update contents on navItems change #86

@Martsim

Description

@Martsim

Problem

Sidenav has prop navItems, in mobile view when said prop updates, it does not trigger change in actual Sidenav content.
Sidenav.mobile caches navItems and does not update contents on prop.navItems change.
Real life problem: user logs in and has to choose a role - sidenav is related to users active role. Alternative, user navigates between pages, navItem isActive value updates but sidenav content does not update.

Solution

Fix Sidenav mobile view to switch out contents of sidenav when new props are presented.

Examples and information

Workaround (not optimal): Add React key prop to root level sidenav and change the key every time props change. Causes sidenav content to update at the cost of recreating the whole component.

Metadata

Metadata

Assignees

Labels

tedi-readyTEDI-Ready component issue

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions