Skip to content

Enhance query handling in FilterFormFactory and flare.js#24

Merged
ericges merged 1 commit into
mainfrom
feat/filter-keep-query-fields
Jun 9, 2026
Merged

Enhance query handling in FilterFormFactory and flare.js#24
ericges merged 1 commit into
mainfrom
feat/filter-keep-query-fields

Conversation

@ericges

@ericges ericges commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

This pull request updates how filter forms handle query parameters in both the frontend JavaScript and form factory. The main change is a switch from the generic data-flare-keep-query attribute to a more structured data-flare-form="keep-query" and the introduction of a dedicated selector for query fields. This improves clarity and maintainability in how forms preserve query parameters.

Frontend JavaScript and form attribute updates:

  • Changed the attribute used to identify forms that should keep query parameters from data-flare-keep-query to data-flare-form="keep-query" in both the JavaScript selector and the form factory output (flare.js, FilterFormFactory.php). [1] [2]
  • Updated the JavaScript logic in flare.js to use a new selector for query fields: [data-flare-form="query-field"], ensuring that any fields with this attribute are properly managed when cleaning up query parameters. [1] [2]

@heimrich-hannot heimrich-hannot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wonderful

Copilot AI 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.

Pull request overview

This PR updates the “keep query params on GET filter forms” behavior by replacing the legacy data-flare-keep-query marker with a structured data-flare-form="keep-query" attribute, and extends the query cleanup logic to also remove explicitly marked query fields.

Changes:

  • Update the Symfony form factory output to render data-flare-form="keep-query" on generated filter forms.
  • Update flare.js to target the new keep-query attribute and additionally delete query params for fields marked with data-flare-form="query-field".

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Form/Factory/FilterFormFactory.php Updates generated filter form attributes to use data-flare-form="keep-query".
public/frontend/flare.js Updates the selector and deletion logic to support structured form/query-field markers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread public/frontend/flare.js
@ericges ericges merged commit f2e6c10 into main Jun 9, 2026
16 checks passed
@ericges ericges deleted the feat/filter-keep-query-fields branch June 9, 2026 14:27
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.

3 participants