fix(settings): extract items from projects menu API response - #416
Merged
Conversation
The auto-heal settings page typed GET /api/projects/menu as a bare
`ProjectMenuItem[]` and mapped over it directly. Both the real route and
the demo service-worker route return `{ items: ProjectMenuItem[] }`, so
`projectsMenu.value` was an object; `(projectsMenu.value ?? []).map(...)`
threw "(intermediate value).map is not a function", crashing the page on
a hard load (F5) where the throw happens during first render.
Unwrap the response with a `transform` and keep the array default,
matching the pattern already used by ProjectsMenu.vue, analytics.vue and
DesktopImportModal.vue.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V5sNCDkLeufETPxTePAKau
Contributor
Coverage Report for Reporter (./packages/reporter)
File CoverageNo changed files found. |
Contributor
Coverage Report for Application (./apps/application)
File CoverageNo changed files found. |
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.
What & why
The
/api/projects/menuendpoint returns a response object with anitemsproperty containing the array ofProjectMenuItem[]. The previous code was treating the entire response as an array, which would cause type mismatches and runtime errors.This change adds a
transformfunction to theuseFetchcall to properly extract theitemsarray from the response object, ensuring the data is correctly typed and structured for downstream usage.How was it tested?
The change is a straightforward data transformation fix that aligns the fetch response handling with the actual API contract. Existing application logic that consumes
projectsMenuwill continue to work correctly with the properly extracted data.Checklist
type(scope): subject)https://claude.ai/code/session_01V5sNCDkLeufETPxTePAKau