Skip to content

[Fleet] Fix styled component theme lookup issue#221979

Merged
nickofthyme merged 4 commits intoelastic:mainfrom
nickofthyme:fix-integrations-theme
May 30, 2025
Merged

[Fleet] Fix styled component theme lookup issue#221979
nickofthyme merged 4 commits intoelastic:mainfrom
nickofthyme:fix-integrations-theme

Conversation

@nickofthyme
Copy link
Contributor

@nickofthyme nickofthyme commented May 29, 2025

Summary

This fixes an issue caused by changes in #220141, specifically here, which prevented the style components from receiving the correct colorMode.

Before

Screenshot 2025-05-29 at 21 36 06

After

Screenshot 2025-05-29 at 21 00 00

This is likely due to how we still use the deprecated EuiThemeProvider which needs to be passed the current colorMode. See code here...

{/* This should be removed since theme is passed to `KibanaRenderContextProvider`,
however, removing this breaks usages of `props.theme.eui` in styled components */}
<EuiThemeProvider darkMode={isDarkMode}>

@nickofthyme nickofthyme requested a review from a team as a code owner May 29, 2025 20:17
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label May 29, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@nickofthyme nickofthyme added release_note:fix backport:version Backport to applied version labels v9.1.0 v8.19.0 and removed Team:Fleet Team label for Observability Data Collection Fleet team labels May 29, 2025
@nickofthyme nickofthyme enabled auto-merge (squash) May 29, 2025 20:22
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label May 29, 2025
Copy link
Contributor

@jen-huang jen-huang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! Would you also mind applying the same to the file at x-pack/platform/plugins/shared/fleet/public/applications/fleet/app.tsx? This plugin exports two apps (Integrations and Fleet) and we are seeing the same happening in both places. TIA :)

@nickofthyme
Copy link
Contributor Author

@jen-huang done

@nickofthyme nickofthyme requested a review from jen-huang May 29, 2025 22:55
Copy link
Contributor

@jen-huang jen-huang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!

@nickofthyme nickofthyme changed the title [Integrations] Fix styled component theme lookup issue May 30, 2025
@elasticmachine
Copy link
Contributor

elasticmachine commented May 30, 2025

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #45 / Embeddable Alerts Table Embeddable alerts panel "before all" hook for "should only show alerts from the observability area (o11y+stack) when selecting it"
  • [job] [logs] FTR Configs #45 / Embeddable Alerts Table Embeddable alerts panel "before all" hook for "should only show alerts from the observability area (o11y+stack) when selecting it"
  • [job] [logs] FTR Configs #27 / lens serverless - group 1 - subgroup 1 lens smokescreen tests should transition from a multi-layer stacked bar to a multi-layer line chart and correctly remove all layers
  • [job] [logs] Fleet Cypress Tests #2 / View agents list Agent status filter should filter on healthy and unhealthy
  • [job] [logs] Fleet Cypress Tests #2 / View agents list Agent status filter should filter on unhealthy (1 result)
  • [job] [logs] Fleet Cypress Tests #2 / View agents list Bulk actions should allow to bulk upgrade agents and cancel that upgrade

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
fleet 1.7MB 1.7MB +48.0B

History

@nickofthyme nickofthyme merged commit f021985 into elastic:main May 30, 2025
10 checks passed
@nickofthyme nickofthyme deleted the fix-integrations-theme branch May 30, 2025 01:43
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19

https://github.com/elastic/kibana/actions/runs/15337328202

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.19 Backport failed because of merge conflicts

You might need to backport the following PRs to 8.19:
- [Theme] fix theme$ usage when used with useObservable (#220141)

Manual backport

To create the backport manually run:

node scripts/backport --pr 221979

Questions ?

Please refer to the Backport tool documentation

nickofthyme added a commit that referenced this pull request Jun 2, 2025
## Summary

This fixes an issue caused by changes in #220141, specifically
[here](https://github.com/elastic/kibana/pull/220141/files#diff-e5bb3127661b2bd4a13f88f8793ee5e7cfdabe3a6deb5332064d28f7363eeb13L49-L51),
which prevented the style components from receiving the correct
`colorMode`. Similar issue fixed in #221979.

In short we cannot call `useKibanaIsDarkMode` outside of the global
theme provider. This usage of the `useDarkMode` utility is needed in
this one case, hopefully soon to be removed with styled-components.
nickofthyme added a commit that referenced this pull request Jun 3, 2025
…0141) (#221708)

# Backport

This will backport the following commits from `main` to `8.19`:
 - #220141
 - #221979
 - #222099

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
zacharyparikh pushed a commit to zacharyparikh/kibana that referenced this pull request Jun 4, 2025
## Summary

This fixes an issue caused by changes in elastic#220141, specifically [here](https://github.com/elastic/kibana/pull/220141/files#diff-90215c9231256571f4b7369e58505a234b7f7b4082cf7c9fda47692787b52222L80-L83), which prevented the style components from receiving the correct `colorMode`.
zacharyparikh pushed a commit to zacharyparikh/kibana that referenced this pull request Jun 4, 2025
## Summary

This fixes an issue caused by changes in elastic#220141, specifically
[here](https://github.com/elastic/kibana/pull/220141/files#diff-e5bb3127661b2bd4a13f88f8793ee5e7cfdabe3a6deb5332064d28f7363eeb13L49-L51),
which prevented the style components from receiving the correct
`colorMode`. Similar issue fixed in elastic#221979.

In short we cannot call `useKibanaIsDarkMode` outside of the global
theme provider. This usage of the `useDarkMode` utility is needed in
this one case, hopefully soon to be removed with styled-components.
nickpeihl pushed a commit to nickpeihl/kibana that referenced this pull request Jun 12, 2025
## Summary

This fixes an issue caused by changes in elastic#220141, specifically [here](https://github.com/elastic/kibana/pull/220141/files#diff-90215c9231256571f4b7369e58505a234b7f7b4082cf7c9fda47692787b52222L80-L83), which prevented the style components from receiving the correct `colorMode`.
nickpeihl pushed a commit to nickpeihl/kibana that referenced this pull request Jun 12, 2025
## Summary

This fixes an issue caused by changes in elastic#220141, specifically
[here](https://github.com/elastic/kibana/pull/220141/files#diff-e5bb3127661b2bd4a13f88f8793ee5e7cfdabe3a6deb5332064d28f7363eeb13L49-L51),
which prevented the style components from receiving the correct
`colorMode`. Similar issue fixed in elastic#221979.

In short we cannot call `useKibanaIsDarkMode` outside of the global
theme provider. This usage of the `useDarkMode` utility is needed in
this one case, hopefully soon to be removed with styled-components.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels backported release_note:fix Team:Fleet Team label for Observability Data Collection Fleet team v8.19.0 v9.1.0

4 participants