Stop the autocomplete from accumulating request parameters while typing
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 88/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- java, javascript
调研方向
从 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;配置一个额外参数,并检查开发者工具,确认每个请求都有一个包含当前输入内容的查询参数。
由索引模型根据 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 fromStartExamplesinwicket-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 分钟
- 30 天内合并 PR
- 167
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/wicket 的其他 Issue
-
PropertyResolver fails on JDK classes with a non-public field named like the property可能已有人在做 @vaibhavgupta443 今天认领。 未关闭good first issue
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
Validate the report-uri value given to CSPHeaderConfiguration#reportBack可能已有人在做 @AzizOuertani 于 3 天前认领。 未关闭good first issue
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
相似的 Issue
-
account assessment course feature lecture
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
app:learninggoalhub enhancement good first issue
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 1/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100