opensearch-project / OpenSearch-Dashboards

📊 Open source visualization dashboards for OpenSearch.
https://opensearch.org/docs/latest/dashboards/index/
Apache License 2.0
1.68k stars 885 forks source link

[BUG] User Theme Selection doesn't retain theme selection #7689

Open virajsanghvi opened 2 months ago

virajsanghvi commented 2 months ago

Describe the bug

After selecting a theme from the user themes selector in the header, the theme gets applied, but the popover doesn't retain the setting. This is because browser based settings don't override persisted settings when the component gets the current value of the setting.

To Reproduce Steps to reproduce the behavior:

  1. Open theme selector in header
  2. Select a theme that isn't next/v8.
  3. theme will be applied, but if you reopen theme selector, next/v8 will be selected

Expected behavior The theme selector shows the currently selected theme.

OpenSearch Version N/A

Dashboards Version OSD/main (unreleased feature)

Plugins

N/A

Screenshots

N/A

Host/Environment (please complete the following information): all

Additional context

N/A

joshuali925 commented 2 months ago

i'm not able to reproduce this on current main Aug-19-2024 16-23-16

virajsanghvi commented 2 months ago

Turn off user based preferences, set another theme in advanced settings as an admin, and then turn on user based preferences - i think you should be able to repro.

virajsanghvi commented 2 months ago

I think the issue is that it treats browser based settings as a default (https://github.com/opensearch-project/OpenSearch-Dashboards/blob/9a842024809218413c8000f380fd90032a90ea03/src/core/public/ui_settings/ui_settings_client.ts#L65), so if the admin has already selected a value, the admin configured value is returned when calling uiSettingsClient.get()

joshuali925 commented 2 months ago

thanks for the details, i'm able to reproduce now