fix: guard against undefined data volumes in workspace details view - #1268
Closed
christian-heusel wants to merge 1 commit into
Closed
Conversation
The details drawer crashed for any Workspace with no data volume: The backend omits `podTemplate.volumes.data` from the JSON response (omitempty) in that case, but the frontend called `.map()` on it unguarded. Fall back to an empty array, matching the pattern already used for the home volume. Assisted-by: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Christian Heusel <christian@heusel.eu>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Member
Author
|
/cc @Snehadas2005 |
Snehadas2005
left a comment
Member
There was a problem hiding this comment.
Thanks for the quick fix, @christian-heusel! This looks pretty good to me. 😊
A couple of things I noticed:
- Root cause confirmed: so, the backend
omitemptyonvolumes.datamakes itundefinedat runtime, but the type generated marks it as required. That's why it was crashing, right? - Fix seems correct and minimal: I like how the
?? []matches what you did forhome. Nice catch! - Good call skipping the full client regen: The version bump pulling in those unrelated
activityProbe/culling schema changes makes total sense. - One thing to flag: just a heads up, #1253 will be moving
volumesout of the list-viewPodTemplateand behind/podtemplate/details. Once that's in place, we might need to change how this component sourcesdatafrom the new endpoint. Can we maybe add a quick TODO/reminder for that so we do not forget?
Thanks again for the quick turnaround! 🙏
/lgtm
thaorell
reviewed
Jul 22, 2026
| // there's no data volume, so it can actually be undefined at runtime. | ||
| // TODO: This can be dropped once the frontend client is regenerated. | ||
| // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
| const workspaceDataVol = workspace.podTemplate.volumes.data ?? []; |
There was a problem hiding this comment.
Member
Author
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.
The details drawer crashed for any Workspace with no data volume: The
backend omits
podTemplate.volumes.datafrom the JSON response(omitempty) in that case, but the frontend called
.map()on itunguarded. Fall back to an empty array, matching the pattern already
used for the home volume.
Related to: #1119
Related-to: #1253
The alternative here is to regenerate the frontend client to be aware of the omitempty, however this currently comes with a lot of unrelated changes (even when going for the minimal bump to 3f1d7ec (which does not yet include the secrets changes)):
click to show diff
Hence bumping the client version requires to implement the new schemas for activityProbe (previously culling).