Skip to content

fix(search): avoid repeated loading for an empty cached station index - #543

Merged
hoangsvit merged 4 commits into
stagingfrom
fix/search-empty-index-loading-20261122
Nov 23, 2026
Merged

hoangsvit merged 4 commits into
stagingfrom
fix/search-empty-index-loading-20261122

Conversation

@hoangsvit

Copy link
Copy Markdown
Member

Reproduction / impact

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.

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Important

Review skipped

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.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

ePlus OnAir — PR Preview

🗃️ Preview expired. This PR is closed; the Preview link is hidden.

View build status

Preview is noindex; the full catalog is available on Staging after merge.

@hoangsvit
hoangsvit marked this pull request as ready for review November 23, 2026 11:13
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@hoangsvit
hoangsvit merged commit 712e7f6 into staging Nov 23, 2026
5 checks passed
@hoangsvit
hoangsvit deleted the fix/search-empty-index-loading-20261122 branch November 23, 2026 11:13

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant