Stop the autocomplete from accumulating request parameters while typing

Open Beginner friendly
#1,947 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@aryankalantri is already working on this.

Since Nov 22, 2026.

  • #1990 by @aryankalantri — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java, javascript
Domain
frontend, web-dev

Research direction

Start in wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js, in prepareAndExecuteAjaxUpdate, and check how pre, sh and ep are copied before values are appended. Run StartExamples from wicket-examples/src/test/java and open org.apache.wicket.examples.ajax.builtin.AutoCompletePage; configure an extra parameter and inspect developer tools to confirm each request has one query parameter with the current input.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Java
Stars
800
Forks
437
Avg merge
21h 36m
Merged PRs (30d)
167

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/wicket

All issues in apache/wicket

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.