Skip to content

Cache query only after validating source and results container - #66

Merged
liuliu-dev merged 1 commit into
github:mainfrom
feritcemkahraman:fix/cache-query-after-validation
Oct 19, 2026
Merged

liuliu-dev merged 1 commit into
github:mainfrom
feritcemkahraman:fix/cache-query-after-validation

Conversation

@feritcemkahraman

Copy link
Copy Markdown
Contributor

Typing or focusing a <remote-input> before src is set or before the aria-owns results element exists in the document caches input.value as currentQuery without issuing a request. Once src or the results container is added, focusing or changing the input with the same value skips the request because currentQuery already matches.

Record currentQuery only after verifying that src and the results container exist. The regressions cover a missing src attribute and a missing aria-owns container, then verify that the request runs once the missing prerequisite becomes available and remains deduplicated on subsequent focus.

Validation: both regressions timed out before the fix; all 11 Chromium tests now pass through Karma. Full ESLint and the UMD/ESM TypeScript builds pass on Node 24. The Windows rm -rf clean script was skipped by removing dist directly before running tsc; Firefox and WebKit were not run.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused change preserves deduplication and includes regression coverage for both missing prerequisites.

No open issues 🎉

What changed in this PR

Fixes premature query caching in <remote-input> so unchanged queries can retry once missing prerequisites become available.

Changes:

  • Cache queries only after validating the source and results container.
  • Add regressions covering retries and subsequent request deduplication.
File Description
test/​test.js Tests recovery when the source or results container becomes available.
src/​index.ts Moves query caching after prerequisite checks.

Review effort: Max

@liuliu-dev
liuliu-dev merged commit 595c603 into github:main Oct 19, 2026
2 checks passed
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.

3 participants