-
-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proxy server hot-reloading does not play nice with htmx #607
Comments
Any reason you closed this one? If it is a problem, it would be pretty easy to rename the variable to |
Sorry, I didn't want to waste anyone's time and it's not too much trouble to suppress the error messages. The issue isn't the chosen variable name, but the script re-executing after htmx page changes, causing a re-declaration error. The issue is specific to servers using htmx or htmx-like libraries (like turbo/turbolinks/pjax). I'm not sure if setups like this are common enough among templ users to warrant fixing the error. Unless there is some dead-simple fix that is low-overhead and doesn't break any other use cases, it's probably not worth it. |
I think this could be a wider issue. I ran into myself while testing something. I've put together a little PR, what do you think? |
Thank you for this! It works great for me and looks like a clean solution without adding too much complexity. And thank you for the rest of your work here. Templ has been a complete pleasure to use. 👍 |
I'm currently using the templ proxy server for development of an application that uses htmx. Everything works as expected except for one slightly annoying console error. Whenever htmx loads a new page from the templ proxy server it re-executes the reload event listener script. This causes a javascript error because of the redeclared identifier (
let src
).This is the script I'm talking about:
I'm currently just hiding error messages from this script using a filter.
Is this a known issue and is there a workaround? Or is there potentially something amiss with my development setup? Would it make sense to use
var src
in the script instead to avoid this error?The text was updated successfully, but these errors were encountered: