Stop the autocomplete from accumulating request parameters while typing

オープン 初心者向け
#1,947 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@aryankalantri がすでに取り組んでいます。

2026年11月22日 から。

  • #1990 @aryankalantri による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java, javascript
領域
frontend, web-dev

調査の方向性

wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js の prepareAndExecuteAjaxUpdate から始め、値を追加する前に pre、sh、ep がどのようにコピーされるかを確認します。wicket-examples/src/test/java から StartExamples を実行し、org.apache.wicket.examples.ajax.builtin.AutoCompletePage を開きます。追加のパラメーターを設定し、開発者ツールで各リクエストに現在の入力値を持つクエリパラメーターが1つあることを確認します。

索引モデルが issue の本文から書いたものです。

説明

good first issue

When an AutoCompleteTextField has extra Ajax attributes (for example a parameter added in updateAjaxAttributes), every keystroke adds another copy of the query parameter to the request. The parameter list keeps growing until the component is re-rendered, and AutoCompleteBehavior.getChoices(String) ends up receiving the first value that was typed instead of the current one.

Where

wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js, function prepareAndExecuteAjaxUpdate:

const attrs = Object.assign({}, ajaxAttributes);
...
attrs.pre = attrs.pre || [];
attrs.pre.push(...);
attrs.sh = attrs.sh || [];
attrs.sh.push(successHandler);
attrs.ep = attrs.ep || [];
attrs.ep.push({'name' : cfg.parameterName, 'value' : currentInput});

Object.assign makes a shallow copy. When ajaxAttributes already has pre, sh or ep arrays, attrs points at the same arrays, and each push modifies the shared original.

Done when

  • Each request carries the query parameter exactly once, with the current input, also when extra parameters are configured.
  • There are no JavaScript unit tests for the autocomplete yet. Verify the fix in the browser with the autocomplete example (wicket-examples, org.apache.wicket.examples.ajax.builtin.AutoCompletePage, started from StartExamples in wicket-examples/src/test/java) by adding an extra parameter and watching the requests in the developer tools. Describe what you checked in the pull request.

Background

Originally reported as WICKET-7130 (Wicket 9.18), with a quickstart attached to the Jira ticket.


Part of #1945. This issue is meant for a first contribution to Wicket. To work on it, leave a comment so others know; a claim without a pull request lapses after two weeks. Questions are welcome, here on the issue or on [email protected]. Start your branch from master, and see Send a pull request to Wicket for building and testing.

主要言語
Java
スター
800
フォーク
437
平均マージ
21時間 36分
マージ済み PR(30日)
167

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/wicket のほかの issue

apache/wicket の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。