Skip to content
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

Option to disable morphing #24

Open
KonnorRogers opened this issue Dec 19, 2024 · 4 comments
Open

Option to disable morphing #24

KonnorRogers opened this issue Dec 19, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@KonnorRogers
Copy link

Libraries like Trix, and a number of other 3rd party javascript libraries tend to have issues with morphing, would it be possible to have an option to disable DOM Diffing and to store scroll position -> hard refresh -> scroll to stored position.

11ty does this with the domDiff option https://www.11ty.dev/docs/dev-server/#options and would be a nice way to still use the reloader if you know you have an incompatible page.

@jorgemanrubia
Copy link
Member

Yes, I like this idea 👍 . Adding this option was something we discussed internally, but we left out for v1. If someone wants to give it a try I'll be happy to review the PR.

To do this, I'd rename the current HtmlReloader to MorphHtmlReloader, and we could add a new HtmlReloader that does a full reload. The engine could dispacth a command morph_html_reload or html_reload depending on whether the option is set.

@jorgemanrubia
Copy link
Member

Or maybe better to keep it a single command and expose the option to the client as we expose the logging one. That way the client decides which command to execute.

@jorgemanrubia
Copy link
Member

Finally I'd go with a Turbo reload here (not a full document reload), to make it smoother. That would introduce a dependency with Turbo, but having Turbo available is a fair assumption here.

@KonnorRogers
Copy link
Author

KonnorRogers commented Dec 19, 2024

Turbo auto binds to the window last I remember, so may not even need to import it.

could be a check with a fallback:

if (window.Turbo) {

} else {

}

@jorgemanrubia jorgemanrubia added the enhancement New feature or request label Dec 20, 2024
codergeek121 added a commit to codergeek121/hotwire-spark that referenced this issue Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants