NO BUG: Radio filter appends URL param instead of replacing when param is pre-set via a direct URL

Browser: Chrome 110
OS: Windows

I have a query loop showing two post types (post and realisation), with a radio Query Filter using a custom URL parameter _type (values post / realisation).

Working as expected:
Using the filter on the page is working just fine. The URL is correctly set as is the active radio state and it filters the loop.

The problem:
If I arrive on the page with a pre-populated URL parameter, e.g., mypage/?_type=realisation, it works, the loop is filtered, and the active state is set on the filter, but then if I use the filter on the page, Bricks appends its value instead of replacing the existing one : ?_type=post&_type=realisation

At that point the filter breaks (wrong state, loop no longer filters correctly), since PHP only keeps the last occurrence while the filter state desyncs.

Is this a known limitation when pre-setting a filter’s custom URL parameter via a direct link? Is there a supported way to deep-link to a pre-filtered state without causing the duplication on the next filter interaction?

Thank you very much :slightly_smiling_face:

Hi Jason,
Thanks so much for your report!

Unfortunately, I cannot reproduce the issue with the current version (2.3.9). Would you be so kind as to provide a live link and a screencast using https://jam.dev showing and explaining what’s happening?

Best regards,
timmse

Ps: These are my filter settings (as basic as they can be):

Hi timmse,

Thank you for responding.

Here you go : Jam

As you can see, at first the filter is working properly, but when going to the same page with a URL parameter, it starts acting weird.

Here are my filter settings, for information:

Thank you very much!

PS : i’m using v 2.3.9, but it was happening on the previous version as well

I checked the URL and noticed that the page currently has two filters connected to the same query using the same URL parameter _type: one Radio filter and one Select filter.

Even if one of them is only used for a different responsive layout and visually hidden, both filter elements are still present in the DOM and can be initialized by Bricks. When the page is opened with ?_type=post, both controls can represent that same selected URL state. Changing one of them can then result in multiple values being serialized for the same _type parameter.

Please test again with only one _type filter present on the page.

Yes that’s it !

It’s not great news for my mobile filter, though. I could make it “work“ using OS conditions, but that’s going to cause way more headaches than necessary, and radio buttons work well enough on mobile :sweat_smile:

Thank you very much for your help!

Have a nice day. :slightly_smiling_face: