Skip to content

UnderlineNav doesn't update its tabs when the items change #4914

Description

@jaked

Description

If you change the items in an UnderlineNav, it doesn't update the tabs.

In the video, I'm generating an UnderlineNav from numItems; if I change the useState initializer, the whole component remounts and the UnderlineNav tabs update; but if I change numItems via setState it causes a rerender but not a remount, and the tabs do not update.

CleanShot.2024-09-03.at.14.29.18.mp4

As far as I can see, this is because the list of children is kept in React state (responsiveProps) that is not updated when the children change. It looks like this was fixed in #2618 but broken again in #3361.

See https://github.com/jaked/primer-react-UnderlineNav-bug for a repro.

Steps to reproduce

as above

Version

v36.27.0

Browser

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions