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

Allow morphing between different URLs #1179

Closed
wants to merge 1 commit into from

Conversation

pch
Copy link

@pch pch commented Feb 8, 2024

Allows morphing between similar types of pages that have different URLs.

A proof-of-concept-fix for the problem described here: #1177

For example, if you set this meta tag:

<meta name="turbo-morph-url-prefix" content="/images/">

Then morphing will be triggered for:

  • /images/1
  • /images/12
  • /images/123

BEFORE:

CleanShot 2024-02-08 at 16 32 21

AFTER:

CleanShot 2024-02-08 at 20 37 13

This solution has some downsides (e.g, won't work with nested resources). A regex-based alternative could address that.

Please let me know if you'd be willing to consider this change and I'll go ahead and add tests.

Allows morphing between similar types of pages that have different URLs.

A proof of concept fix for the problem descrubed here: hotwired#1177

For example, if you set this meta tag:

<meta name="turbo-morph-url-prefix" content="/images/">

Then morphing will be triggered for:

- `/images/1`
- `/images/12`
- `/images/123`

This solution has some downsides (e.g, won't work with nested
resources). A regex-based alternative could address that.

Please let me know if you'd be willing to consider this change and I'll
go ahead and add tests.
@pch
Copy link
Author

pch commented Feb 8, 2024

A more elegant (and flexible) alternative to the above would be a per-link setting:

<a href="/image/123" data-turbo-morph="true">Visit with morph</a>

But I haven't explored this path yet...

@websymphony
Copy link

👋 @pch Not sure if you have seen but there is already a PR, trying to solve same problem.

@pch
Copy link
Author

pch commented Feb 12, 2024

Closing this, I'll move the discussion to #1145

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants