Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Do not submit form when the filter params are not changed.

Dombi Attila051ff9efc659
diff --git a/frontend/src/stimulus/controllers/dynamic/filter/filters-form.controller.ts b/frontend/src/stimulus/controllers/dynamic/filter/filters-form.controller.ts
index 77305dbef2d..9bcf84db9ca 100644
--- a/frontend/src/stimulus/controllers/dynamic/filter/filters-form.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/filter/filters-form.controller.ts
@@ -309,14 +309,20 @@ export default class FiltersFormController extends Controller {
}
sendForm() {
- const ajaxIndicator = document.querySelector('#ajax-indicator') as HTMLElement;
- ajaxIndicator.style.display = '';
-
const params = new URLSearchParams();
-
params.append('filters', this.buildFiltersParam(this.parseFilters()));
const currentParams = new URLSearchParams(window.location.search);
+
+ if (params.get('filters') === currentParams.get('filters')) {
+ // Some fields may be triggered via the input event and the change event too.
+ // This early return will prevent firing request when the filter params are not changed.
+ return;
+ }
+
+ const ajaxIndicator = document.querySelector('#ajax-indicator') as HTMLElement;
+ ajaxIndicator.style.display = '';
+
FiltersFormController.paramsToCopy.forEach((name) => {
if (currentParams.has(name)) {
params.append(name, currentParams.get(name) as string);