[9.1] [Discover][APM] Check for undefined data from useFetcher in TraceWaterfallEmbeddable (#240843)#241095
Merged
iblancof merged 2 commits intoelastic:9.1from Oct 29, 2025
Merged
Conversation
…fall (elastic#240843) ## Summary Closes elastic#238405 Since we upgraded the error handling strategy to catch Fatal React Errors, we’ve started seeing `TypeError: Cannot read properties of undefined (reading 'map')` in versions 8.19.x and 9.1.x. <img width="809" height="121" alt="Screenshot 2025-10-27 at 16 03 48" src="https://github.com/user-attachments/assets/042a4118-8294-4701-8d0b-590321a2bde8" /> After reviewing the error stack, we found that this occurs because `traceItems` is occasionally arrive as `undefined`. Although TS enforces that it should always be defined, a potential API malfunction may cause this scenario. To prevent users from encountering an uncontrolled error, this PR adds a check for `undefined` for `data` coming from the `useFetcher` (more details in [this comment](elastic#240843 (comment))). This ensures that the UI behaves safely even if `traceItems` is unexpectedly `undefined`. |Before|After| |-|-| ||<img width="1405" height="968" alt="Screenshot 2025-10-28 at 14 26 04" src="https://github.com/user-attachments/assets/1d4453df-25b5-4573-b29f-0da76f42b064" />| I also took the chance to update the UI, so the error message is more visible: |Before|After| |-|-| |<img width="1405" height="968" alt="Screenshot 2025-10-28 at 14 26 04" src="https://github.com/user-attachments/assets/1d4453df-25b5-4573-b29f-0da76f42b064" />|<img width="1405" height="966" alt="Screenshot 2025-10-28 at 14 24 51" src="https://github.com/user-attachments/assets/3426defd-58fc-4ea8-950c-1163bb11cb20" />| The same error has been now added to the `TraceWaterfallEmbeddable`: <img width="1387" height="135" alt="Screenshot 2025-10-28 at 14 27 31" src="https://github.com/user-attachments/assets/3bd01cb3-b716-4216-82de-ec02d7f01bdf" /> (cherry picked from commit 7d2975b) # Conflicts: # x-pack/solutions/observability/plugins/apm/public/embeddable/trace_waterfall/trace_waterfall_embeddable.tsx
Contributor
|
Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services) |
crespocarlos
approved these changes
Oct 29, 2025
Contributor
💔 Build Failed
Failed CI Steps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto9.1:Questions ?
Please refer to the Backport tool documentation