Skip to content

CommandBar: componentRefs get wiped out when resizing/re-rendering  #7582

@nikhilpuria

Description

@nikhilpuria

I am trying to use Calendar component with a Callout inside a Commandbar. By default the Calendar component does not auto close on selection and for that reason I call the dismissMenu() function on onSelectDate() of Calendar. But there is some issue around the setting of the ref. Its gets set only once and the second time it comes as null. If I give a unique key to the CommandBar (i.e force react to mount the whole CommandBar everytime then it works)

Environment Information

  • Package version(s): 6.106.3
  • Browser and OS versions: (fill this out if relevant)

Please provide a reproduction of the bug in a codepen:

https://codepen.io/nikhilpuria/pen/PXaaVP?editors=1010

Expected behavior:

componentRef is called only once

Actual behavior:

componentRef should be called everytime the component is rendered

Priorities and help requested:

Are you willing to submit a PR to fix? (Yes, No)

Requested priority: (Blocking, High, Normal, Low)

Products/sites affected: (if applicable)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions