You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(search): avoid repeated loading for an empty cached station index - #543
useStationSearchIndex.load() checks index.value.length to determine success. A valid [] response is cached by createCachedLoader, but each subsequent search focus still toggles loading true/false because length stays zero. Expected: a successfully loaded empty index should remain loaded without repeated loading indicators; rejected requests must remain retryable.
Fix
Track successful completion separately from array length, only marking loaded after a successful response while component remains mounted. Keep existing shared fetch cache and retry semantics unchanged.
Regression and verification
Added tests/search-index-load-state.test.mjs for empty-success, retryable failure and independent component instances. Three focused tests passed with Node 22.16.0 locally. Full npm ci && npm test on required Node 24.15.0, CI and browser QA are pending; no browser success claimed.
Risk and acceptance
Low; search UI state only. Verify opening search repeatedly after a valid empty response does not flash loading, network fetch is not repeated, a failed fetch can be retried, and normal nonempty search results are unchanged. No merge/deploy/release requested.
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing
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
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.
Reproduction / impact
useStationSearchIndex.load()checksindex.value.lengthto determine success. A valid[]response is cached bycreateCachedLoader, but each subsequent search focus still togglesloadingtrue/false because length stays zero. Expected: a successfully loaded empty index should remain loaded without repeated loading indicators; rejected requests must remain retryable.Fix
Track successful completion separately from array length, only marking loaded after a successful response while component remains mounted. Keep existing shared fetch cache and retry semantics unchanged.
Regression and verification
Added
tests/search-index-load-state.test.mjsfor empty-success, retryable failure and independent component instances. Three focused tests passed with Node 22.16.0 locally. Fullnpm ci && npm teston required Node 24.15.0, CI and browser QA are pending; no browser success claimed.Risk and acceptance
Low; search UI state only. Verify opening search repeatedly after a valid empty response does not flash loading, network fetch is not repeated, a failed fetch can be retried, and normal nonempty search results are unchanged. No merge/deploy/release requested.