carbon-addons-iot-react icon indicating copy to clipboard operation
carbon-addons-iot-react copied to clipboard

[SideNav] SideNav not updating for SuiteHeader

Open zhaozhuo813 opened this issue 3 years ago • 2 comments

What package is this for?

  • [x] React
  • [ ] Angular

Describe the bug

we pass links data to sidenav, but we found the sidenav component won’t refresh when the links data updated, so we have to only initialize this component after all data ready.

zhaozhuo813 avatar Oct 08 '22 02:10 zhaozhuo813

@davidicus

zhaozhuo813 avatar Oct 08 '22 02:10 zhaozhuo813

@zhaozhuo813 Hello, would you please offer more details for this issue? So far, I couldn't reproduce it.

In SideNav story, we have knobs like show deep nesting example, Demo pinned link during search and Demo most recent links to change the links prop. Whenever we change any of the knobs, the link data changed and we can see the change reflected in the SideNav story. I also tried update the link meta, the change also got picked up.

Anything we missed? Thanks!

jessieyan avatar Oct 19 '22 16:10 jessieyan

@jessieyan I'm not sure if it's caused by using an old version, in our project, it uses carbon-addons-iot-react: 2.150.1-next.12 in last release code. When we pass links which has not been initialized first, but later, we update links and it will not take effect to the side nav. <SideNav links={links} isSideNavExpanded={isLeftNavOpen} />

zhaozhuo813 avatar Dec 02 '22 15:12 zhaozhuo813

@zhaozhuo813

The version 2.150.1-next.12 should work fine.

Do you manage state of the links? You would need to mange a state of the links. When links state changes, it triggers the re-render of <SideNav>

jessieyan avatar Dec 13 '22 21:12 jessieyan

Please feel free to reopen if issues still exist.

jessieyan avatar Apr 04 '23 19:04 jessieyan