You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The HeaderControl component, which is used to render controls in the header's right side, does not update its content when the controls prop changes if the component was not mounted during the initial render. This issue occurs when the HeaderControl component is conditionally rendered based on a state or prop that changes over time, and the condition is not met during the initial render.
To Reproduce
Create a component that conditionally renders the HeaderControl component based on a state or prop that changes over time.
Ensure that the condition for rendering the HeaderControl component is not met during the initial render.
After the state or prop changes, and the condition is met, the HeaderControl component should be rendered, but its content (the controls prop) is not updated.
In the above code, the HeaderControl component should not be rendered at the first time (when currentTime is undefined) and should be rendered after 1 second with the current time. However, the current time is not updated after the initial render.
Expected behavior
The HeaderControl component should update its content (the controls prop) whenever the state or prop changes, even if the component was not mounted during the initial render.
OpenSearch Version
N/A
Dashboards Version
Latest main
Plugins
N/A
Screenshots
N/A
Host/Environment (please complete the following information):
Describe the bug
The
HeaderControl
component, which is used to render controls in the header's right side, does not update its content when thecontrols
prop changes if the component was not mounted during the initial render. This issue occurs when theHeaderControl
component is conditionally rendered based on a state or prop that changes over time, and the condition is not met during the initial render.To Reproduce
HeaderControl
component based on a state or prop that changes over time.HeaderControl
component is not met during the initial render.HeaderControl
component should be rendered, but its content (thecontrols
prop) is not updated.Sample Code
In the above code, the
HeaderControl
component should not be rendered at the first time (whencurrentTime
isundefined
) and should be rendered after 1 second with the current time. However, the current time is not updated after the initial render.Expected behavior
The
HeaderControl
component should update its content (thecontrols
prop) whenever the state or prop changes, even if the component was not mounted during the initial render.OpenSearch Version
N/A
Dashboards Version
Latest main
Plugins
N/A
Screenshots
N/A
Host/Environment (please complete the following information):
Additional context
The root cause might be related to the
headerRightControl
not being rendered due to a conditional return statement in theHeader
component: https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/core/public/chrome/ui/header/header.tsx#L398The text was updated successfully, but these errors were encountered: