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

Cannot morph node with turbo-frame within #5

Open
pySilver opened this issue Nov 9, 2022 · 2 comments
Open

Cannot morph node with turbo-frame within #5

pySilver opened this issue Nov 9, 2022 · 2 comments

Comments

@pySilver
Copy link

pySilver commented Nov 9, 2022

Not sure if it's a bug or expected behaviour but having this markup initially on page:

<turbo-frame id="product_list" src="_partials/product/list.html" loading="lazy" target="_top">This is the ORIGINAL product list that is expensive to load on initial page load</turbo-frame>

We cannot issue the following morph:

<turbo-stream action="morph" target="product_list">
  <template
    ><turbo-frame id="product_list"> This is the NEW product list</turbo-frame>
  </template>
</turbo-stream>

The following happens:

  1. Morph modifies content of a turbo frame but for some reason it triggers frame reload that in turn reverts original content.
@pySilver
Copy link
Author

pySilver commented Nov 9, 2022

Interesting enough typical replace action does not have such side effects.

@marcoroth
Copy link
Owner

Hey @pySilver, thanks for opening this issue. This is definitely an interesting use-case!

Usually I would say, if the replace/update action serves your needs just use them over morph.

Though I still want to also make this work for the morph action as well. Or - at least - explain why it doesn't work.

I will take a look and come back to you with my results.

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

No branches or pull requests

2 participants