Skip to content

Migrate from Turbolinks 5 to Hotwire Turbo 8 #2087

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

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Conversation

amitaibu
Copy link
Collaborator

@amitaibu amitaibu commented Jul 8, 2025

Migrates IHP from legacy Turbolinks 5.1.1 to modern Hotwire Turbo 8.0.13, replacing morphdom with Turbo's built-in morphing.

Changes

• Replace Turbolinks with Turbo 8.0.13 bundle
• Remove morphdom dependency - use Turbo's Idiomorph instead
• Enable morphing with <meta name="turbo-refresh-method" content="morph">
• Update auto-refresh to use Turbo Streams
• Migrate transitionToNewPage() to Turbo.renderPage() API
• Update events: turbolinks:loadturbo:load

Benefits

🚀 Better performance with Idiomorph vs morphdom
📦 Single library instead of multiple dependencies
🔧 Actively maintained vs discontinued Turbolinks

Test plan

  • IDE navigation works
  • Auto-refresh preserves form state
  • Live reload
  • Handle js-delete
  • Server-side components functional
  • IDE close modal dialogs
  • IDE Delete button

🤖 Generated with Claude Code

@amitaibu
Copy link
Collaborator Author

amitaibu commented Jul 8, 2025

This will require more testing, and likely would need a new release with upgrade notes (to update the JS files projects call on Layout.hs)

Peek.2025-07-08.17-39.mp4

But so far it's working 🤯

Seems to also fix #2063 that triggered this experiment 😄

@amitaibu
Copy link
Collaborator Author

amitaibu commented Jul 8, 2025

Auto refresh is also working.

Peek.2025-07-08.18-59.mp4

@amitaibu
Copy link
Collaborator Author

amitaibu commented Jul 8, 2025

I'm trying to check the SSC following https://ihp.digitallyinduced.com/Guide/server-side-components.html#serverside-components

But I'm getting this error.

image

My flake.nix has ihp.url = "path:///home/amitaibu/Sites/ihp-landing-page/IHP";, and I've nix flake update and direnv allow

What else might I be missing?

p.s. Is anyone using SSC? Is this a feature we might want to drop at a certain point?

@amitaibu
Copy link
Collaborator Author

amitaibu commented Jul 8, 2025

@mpscholten this can already benefit from a review/ testing locally, as it's a big change.

@amitaibu
Copy link
Collaborator Author

amitaibu commented Jul 8, 2025

I've fixed ihp-scc not working, maybe it's not needed if running non-local IHP 🤷

haskellPackages = p: with p; [
    # Haskell dependencies go here
    p.ihp
+   p.ihp-ssc

@amitaibu
Copy link
Collaborator Author

amitaibu commented Jul 8, 2025

SSC is now included in the compile, but it complains about the code from the guide. So maybe someone that has ever used it, should give it a try 😄

@amitaibu
Copy link
Collaborator Author

@unhammer care to check your scenario with the back button? You can do it by changing in your flake.nix

  1. ihp.url = "github:digitallyinduced/ihp/pull/2087/head"; and direnv reload
  2. And in Layout.hs
- <script src={assetPath "/vendor/morphdom-umd.min.js"}></script>
+ <script src={assetPath "/vendor/turbo.js"}></script>
- <script src={assetPath "/vendor/turbolinks.js"}></script>
- <script src={assetPath "/vendor/turbolinksInstantClick.js"}></script>
- <script src={assetPath "/vendor/turbolinksMorphdom.js"}></script>

@amitaibu amitaibu marked this pull request as ready for review July 10, 2025 11:23
@amitaibu amitaibu marked this pull request as draft July 10, 2025 11:31
@amitaibu amitaibu marked this pull request as ready for review July 10, 2025 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant