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

refresh="morph" in a turbo-frame morphs on a full Page Reload but fails to morph with frame.reload() #1161

Closed
krschacht opened this issue Feb 4, 2024 · 3 comments

Comments

@krschacht
Copy link
Contributor

krschacht commented Feb 4, 2024

@jorgemanrubia acknowledge the issue over on this PR comment: #1068 (comment)

To elaborate on the issue for whomever may tackle this. Imagine this page setup:

<body>
   Contents outside of frame
   
   <turbo-frame id="post" refresh="morph" src="/post/1">
      Loading... (preload contents)
   </turbo-frame>
</body>

If something triggers a full Page Reload causing to be morphed rather than replaced, the presence of refresh="morph" is smart and it also re-requests the src and morphs the response from src so that the contents within side turbo-frame only updates what is needed.

However, if you instead trigger a refresh to the frame using javascript, e.g. document.getElementById('post').reload() the turbo-frame ignores the refresh="morph" and does a full replacement within the turbo-frame.

The ideal behavior:
When refresh="morph" is present on a turbo-frame then anything that triggers a refresh of that turbo-frame (e.g. element.reload()) should be a morphing refresh.

@krschacht
Copy link
Contributor Author

Hi @jorgemanrubia I went ahead and tee'd up a PR to fix this issue. Check #1192

@seanpdoyle
Copy link
Contributor

@krschacht was this issue resolved by #1192 and #1028?

If it has been resolved, should it be closed?

@krschacht
Copy link
Contributor Author

Yep, closing

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

No branches or pull requests

2 participants