Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HeaderControl not rendered if not mount in initial rendering #8335

Merged

Conversation

wanglam
Copy link
Contributor

@wanglam wanglam commented Sep 25, 2024

Description

This PR is for fixing HeaderControl not rendered if not mount in initial rendering. The original implementation rely on controls registered to application.currentRightControls$ before Header component rendering. This component won't re-render after new value emitted in application.currentRightControls$. This PR add a new useObservableValue to subscribe these controls updates. It will fire re-render after these observable emit new values.

Issues Resolved

#8313

Screenshot

This is a bug fix, no UI changes.

Testing the changes

  • Clone branch code and run yarn osd bootstrap --single-version loose
  • Add below configs in config/opensearch_dashboards.yml
savedObjects.permission.enabled: true
workspace.enabled: true
uiSettings:
  overrides:
    'home:useNewHomePage': true
opensearchDashboards.dashboardAdmin.users: ['admin']
  • Run yarn start --no-base-path
  • Visiting a existing workspace settings page with admin user
  • The delete button should be displayed

Changelog

  • fix: Fix HeaderControl not rendered if not mount in initial rendering

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Copy link

codecov bot commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.95%. Comparing base (1db585d) to head (5d8702c).
Report is 49 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8335      +/-   ##
==========================================
- Coverage   64.14%   60.95%   -3.19%     
==========================================
  Files        3743     3744       +1     
  Lines       88849    88854       +5     
  Branches    13856    13857       +1     
==========================================
- Hits        56993    54164    -2829     
- Misses      31241    31380     +139     
- Partials      615     3310    +2695     
Flag Coverage Δ
Linux_1 28.85% <3.70%> (-1.21%) ⬇️
Linux_2 ?
Linux_3 37.78% <3.70%> (-2.58%) ⬇️
Linux_4 29.94% <3.70%> (-1.64%) ⬇️
Windows_1 28.87% <3.70%> (-1.21%) ⬇️
Windows_2 56.30% <100.00%> (-2.52%) ⬇️
Windows_3 37.79% <3.70%> (-2.58%) ⬇️
Windows_4 29.94% <3.70%> (-1.64%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

ruanyl
ruanyl previously approved these changes Sep 26, 2024
src/core/public/utils/use_observable_value.ts Outdated Show resolved Hide resolved
@ruanyl ruanyl merged commit 8691010 into opensearch-project:main Sep 27, 2024
71 of 73 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 27, 2024
* Add useObservableValue hook

Signed-off-by: Lin Wang <[email protected]>

* Fix header control not render when not mount in initial rendering

Signed-off-by: Lin Wang <[email protected]>

* Changeset file for PR #8335 created/updated

* Import useObservable from lib folder

Signed-off-by: Lin Wang <[email protected]>

* Change to useObservable for non function observable object

Signed-off-by: Lin Wang <[email protected]>

* Update src/core/public/utils/use_observable_value.ts

Co-authored-by: Yulong Ruan <[email protected]>
Signed-off-by: Lin Wang <[email protected]>

---------

Signed-off-by: Lin Wang <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Co-authored-by: Yulong Ruan <[email protected]>
(cherry picked from commit 8691010)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants