wailsapp / wails

Create beautiful applications using Go
https://wails.io
MIT License
24.71k stars 1.18k forks source link

HTMX poll mechanism is broken #3749

Closed gerbil closed 2 weeks ago

gerbil commented 2 weeks ago

Description

HTMX hx-trigger="click, every 10s" will be executed for every element even if it's not clicked ever.

To Reproduce

  1. use HTMX
  2. create two elements with hx-trigger="click, every 10s"
  3. observe two separate calls for hx-get url/api triggered every 10s (even when non of the html elements clicked)

Expected behaviour

Screenshots

No response

Attempted Fixes

No response

System Details

# Wails
Version | v2.9.1

# System
┌─────────────────────────────────────────────────────────────────────────────────────────────┐
| OS           | Windows 10 Enterprise                                                        |
| Version      | 2009 (Build: 22631)                                                          |
| ID           | 23H2                                                                         |
| Go Version   | go1.21.0                                                                     |
| Platform     | windows                                                                      |
| Architecture | amd64                                                                        |
| CPU          | 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz                               |
| GPU 1        | MirrorOp Virtual Graphics Adaptor (MirrorOp) - Driver: 1.1.185.70            |
| GPU 2        | Citrix Indirect Display Adapter (Citrix Systems Inc.) - Driver: 12.40.44.247 |
| GPU 3        | Intel(R) Iris(R) Xe Graphics (Intel Corporation) - Driver: 31.0.101.5388     |
| Memory       | 32GB                                                                         |
└─────────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌───────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version       |
| WebView2   | N/A          | Installed | 127.0.2651.98 |
| Nodejs     | N/A          | Installed | 22.1.0        |
| npm        | N/A          | Installed | 10.7.0        |
| *upx       | N/A          | Available |               |
| *nsis      | N/A          | Available |               |
└─────────────── * - Optional Dependency ───────────────┘

# Diagnosis
Optional package(s) installation details:
  - upx : Available at https://upx.github.io/
  - nsis : More info at https://wails.io/docs/guides/windows-installer/

 SUCCESS  Your system is ready for Wails development!

Additional context

No response

leaanthony commented 2 weeks ago

Webviews don't currently support SSE but there is this plugin you might be interested in: https://github.com/lllama/wails-htmx

gerbil commented 2 weeks ago

SSE? Im talking about just js based polling here.

PylotLight commented 2 weeks ago

@gerbil This is expected behaviour for htmx. You've defined 2 separate behaviours. Click is not a filter here. This reads as Click OR every 10s. Not AND.

gerbil commented 2 weeks ago

@gerbil This is expected behaviour for htmx. You've defined 2 separate behaviours. Click is not a filter here. This reads as Click OR every 10s. Not AND.

You right, seems like i need to use some event for specific element to be triggered separately. Thank you!