fix(search): unwrap bare-array response in searchAudibleByTitleAndAuthor#749
Draft
kevinheneveld wants to merge 1 commit into
Draft
fix(search): unwrap bare-array response in searchAudibleByTitleAndAuthor#749kevinheneveld wants to merge 1 commit into
kevinheneveld wants to merge 1 commit into
Conversation
The Advanced-mode branch of POST /search returns a bare JSON array,
not {results, totalResults} — confirmed live against a real Audible
title/author search: the backend genuinely found the book, but the UI
still reported "no matches in any region", because this function only
ever read response.results, which doesn't exist on a plain array.
The other two frontend callers of this same endpoint
(getAuthorLookup, advancedSearch) already defensively handle both
response shapes; this one never did, so every search through it
silently discarded whatever the backend found and always fell through
to the empty-results path, regardless of query quality.
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.
Summary
POST /searchin Advanced mode returns a bare JSON array, not{results, totalResults}searchAudibleByTitleAndAuthoronly ever readresponse.results, which doesn't exist on a plain array, so it silently discarded every result and always reported empty — confirmed live against a real Audible title/author search where the backend genuinely found the matchgetAuthorLookup,advancedSearch) already defensively handle both shapes (Array.isArray(resp) ? resp : (resp?.results ?? [])); this one never didTest plan
vue-tsc --build— cleanvite build— cleanvitest run— 394/394 passing (2 new regression tests: bare-array shape + object-wrapped shape)Draft per PR-pacing convention (several PRs already active); will promote when a slot frees up.