wimdeblauwe / htmx-spring-boot

Spring Boot and Thymeleaf helpers for working with htmx
Apache License 2.0
521 stars 49 forks source link

Regression, multiple hx-triggers not formatted correctly #126

Closed checketts closed 3 months ago

checketts commented 3 months ago

I found a regression when I upgrade from a very old version of this library (something like 0.8) to v3.4.1.

When returning an HtmxResponse with multiple triggers (that don't include any data), the format is now incorrect.

HtmxResponse.builder().trigger("trigger1").trigger("trigger2").build()

Old (correct) header: Hx-Trigger {"trigger1":null,"trigger2":null}

New (incorrect): Hx-Trigger trigger1, trigger2

Current workaround add some data to force the correct formatting:

HtmxResponse.builder().trigger("trigger1", new Hashmap()).trigger("trigger2", new Hashmap()).build()

I'll look into the root cause and try to create a fix and unit test.

checketts commented 3 months ago

I just checked and the htmx documentation indicates that the current (comma delimited) formatting should be supported.

So I'll double check the HTMX handling to determine what is missing

checketts commented 3 months ago

OK turns out I needed to upgrade our HTMX version to a more recent version to handle the comma delimited approach. (Not supported in 1.8.0, but was added in 1.9.4)