Centralize phase colors and descriptions#266680
Conversation
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
History
cc @SoniaSanzV |
flash1293
left a comment
There was a problem hiding this comment.
Onboarding changes LGTM< just adding a new type dependency
damian-polewski
left a comment
There was a problem hiding this comment.
Thanks for working on this improvement! Code looks good and everything works well, I added one small nit but overall LGTM!
| } | ||
| ), | ||
| }, | ||
| return { |
There was a problem hiding this comment.
Just checking: are we removing useMemo here intentionally? We still might want to keep the values cached.
…ilder_new_vis_attachment * commit '6fd683609eb6dee81f242f8ff6951edbe3bfd66c': (226 commits) Remove Model Author group-by option from external inference endpoints (elastic#264761) [Streams][Streamlang] Align ES|QL condition transpiler with Painless on null propagation (elastic#264751) chore(axios,workflows-eng): remove axios from workflows connector utils (elastic#267512) [failed-test-reporter] avoid opening issues for scout env failures (elastic#267649) [kbn-api-contracts] Detect request-body additionalProperties:false tightening (elastic#267546) [main] Sync bundled packages with Package Storage (elastic#267644) Centralize phase colors and descriptions (elastic#266680) [Unified Waterfall] Add "Scroll to origin" button (elastic#266594) [APM] Add alert and SLO badges to the service map embeddable (elastic#266360) [CI] Speed up telemetry_check by pre-filtering to collector files (elastic#265978) [Discover] Address flaky large CSV test (elastic#266642) avoid passing unrelated props within integration card icon component conditional render (elastic#266569) [Cases][Templates] Extend cases search by template field label (elastic#266414) [Background search] Migrate custom SplitButton to EuiSplitButton (elastic#267447) [i18n] Report translation coverage during integrate (elastic#264124) [api-docs] 2026-05-05 Daily api_docs build (elastic#267639) [Scout] Update test config manifests (elastic#267636) [content list] Add saved object provider services (elastic#266428) [Fleet] Otel UI add health and implement it in OTelComponentDetail (elastic#267292) Update dependency msw to v2.13.4 (main) (elastic#266770) ...
## Summary
On the Streams retention management page
(`/app/streams/{name}/management/retention`), the `GET
/internal/streams/{name}/lifecycle/_explain` endpoint was being called
in an infinite loop. Every render triggered a new fetch, which caused a
state update, which triggered another render, and so on.
The root cause was referential instability in `usePhaseColors`
(`kbn-data-lifecycle-phases`): it returned a plain object literal on
every render with no memoization. This made `ilmPhases` (built from
`phaseColors` in `useIlmPhasesColorAndDescription`) also a new reference
every render. Since `ilmPhases` was in the dependency array of
`useIngestionRatePerTier`, the fetch — including the `_explain` call —
re-ran on every render. This was caused by
#266680
Two fixes:
- `usePhaseColors` now wraps its return value in `useMemo`, keyed on the
individual EUI theme color tokens. The color map is only recreated on
theme changes (e.g. dark/light mode toggle).
- `useIlmPhasesColorAndDescription` now wraps `ilmPhases` in `useMemo`
keyed on `phaseColors`. Since `phaseColors` is now stable, `ilmPhases`
is also stable, and `useIngestionRatePerTier` no longer re-fires on
every render.
### Test plan
- Navigate to `/app/streams/{name}/management/retention` on a
non-serverless environment with a stream that has an ILM policy.
- Open the browser network tab and filter for `lifecycle/_explain`.
- Verify the endpoint is called once on page load (and again only when
the time range changes), not continuously.
## Summary
On the Streams retention management page
(`/app/streams/{name}/management/retention`), the `GET
/internal/streams/{name}/lifecycle/_explain` endpoint was being called
in an infinite loop. Every render triggered a new fetch, which caused a
state update, which triggered another render, and so on.
The root cause was referential instability in `usePhaseColors`
(`kbn-data-lifecycle-phases`): it returned a plain object literal on
every render with no memoization. This made `ilmPhases` (built from
`phaseColors` in `useIlmPhasesColorAndDescription`) also a new reference
every render. Since `ilmPhases` was in the dependency array of
`useIngestionRatePerTier`, the fetch — including the `_explain` call —
re-ran on every render. This was caused by
elastic#266680
Two fixes:
- `usePhaseColors` now wraps its return value in `useMemo`, keyed on the
individual EUI theme color tokens. The color map is only recreated on
theme changes (e.g. dark/light mode toggle).
- `useIlmPhasesColorAndDescription` now wraps `ilmPhases` in `useMemo`
keyed on `phaseColors`. Since `phaseColors` is now stable, `ilmPhases`
is also stable, and `useIngestionRatePerTier` no longer re-fires on
every render.
### Test plan
- Navigate to `/app/streams/{name}/management/retention` on a
non-serverless environment with a stream that has an ILM policy.
- Open the browser network tab and filter for `lifecycle/_explain`.
- Verify the endpoint is called once on page load (and again only when
the time range changes), not continuously.
Closes #266417
Summary
index_lifecycle_managementandstreams_appplugins, causing duplicated i18n tokens and a behavioral divergence in thedeletephase color.@kbn/data-lifecycle-phases(owner:@elastic/kibana-management) that exportsPHASE_ORDER,PHASE_NAMES,PHASE_TITLES,PHASE_SHORT_DESCRIPTIONS,PHASE_DESCRIPTIONS, andusePhaseColors. Both plugins now import from it.deletephase color was misaligned:streams_appdeclaredborderBasePlaininuse_ilm_phases_color_and_description.tsxbut individual components (lifecycle_phase.tsx,downsampling_bar.tsx) were silently overriding it witheuiTheme.colors.backgroundBaseSubdueddirectly — so the declared value was never actually used. The canonical token is nowbackgroundBaseSubdued, defined once inusePhaseColorsand consumed everywhere.use_phase_colors.tsin ILM (a trivial re-export shim) is removed; consumers importusePhaseColorsdirectly from@kbn/data-lifecycle-phases.ILM_PHASE_ORDERandPHASE_LABELSaliases inx-pack/platform/plugins/shared/streams_app/public/components/stream_management/data_management/stream_detail_lifecycle/downsampling/edit_ilm_phases_flyout/constants.tsare removed; call sites now use the canonicalPHASE_ORDERandPHASE_NAMESdirectly from@kbn/data-lifecycle-phases.How to test