Skip to content

Add incremental search dummy and live input dispatch - #19

Open
manabeai wants to merge 4 commits into
masterfrom
incremental-search-e2e
Open

Add incremental search dummy and live input dispatch#19
manabeai wants to merge 4 commits into
masterfrom
incremental-search-e2e

Conversation

@manabeai

Copy link
Copy Markdown
Owner

概要

  • インクリメンタルサーチのダミーを追加
  • vcr_live_input で入力イベントからディスパッチする最小実装を追加
  • e2e にインクリメンタル入力を追加

テスト

  • mise run all(e2eは既存の3001番サーバー再利用で古いテンプレが当たる場合があるので再起動推奨)

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 83401959ba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +13 to +28
document.addEventListener("input", function(event) {
var input = event.target;
if (!(input instanceof HTMLInputElement)) return;
if (!input.matches("[data-vcr-live-input]")) return;
var form = input.closest("form[data-vcr-form][data-vcr-live]");
if (!form) return;
var payloadField = form.querySelector('input[name="vcr_msg_payload"]');
if (payloadField) {
var payloadKey = payloadField.dataset.vcrPayloadKey || input.name;
var payloadValue = input.value || "";
payloadField.value = JSON.stringify({ [payloadKey]: payloadValue });
}
var submitter = form.querySelector("[data-vcr-live-submit]");
if (submitter) {
submitter.click();
} else if (form.requestSubmit) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Guard against out-of-order responses on live input

Because every input event triggers a submit (submitter.click()), rapid typing can fire multiple concurrent fetches, and the submit handler always replaces the DOM with the last response to resolve. If an earlier request returns after a later one (slow network or server), the UI can be reverted to stale results (e.g., typing “state” shows results for “sta”). Consider aborting the previous request or attaching a monotonically increasing request id and ignoring late responses for data-vcr-live forms.

Useful? React with 👍 / 👎.

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