Vue: iframe triggers unnecessary reload

Created on 11 Feb 2019  路  4Comments  路  Source: vuejs/vue

Version

2.6.5

Reproduction link

https://codesandbox.io/s/1q5prknzk7

Steps to reproduce

click trigger button

What is expected?

iframe not reload when component not update.
The dom element is reused when the component is not updated.

What is actually happening?

iframe reload when component not update.


I think it should be related to the virtual dom's diff rule.
When the showspan1 and showspan2 are changed at the same time, the reload iframe will appear.
This problem also exists in version 2.5.x.

has workaround improvement

Most helpful comment

<iframe>s will reload whenever they are detached from the document (or after inserting them to a new location). It's definitely better if we try to move other elements around <iframe>s first but this would introduce extra complexity to the existing patching algorithms. React seems to keep the <iframe> alive in similar cases: https://codesandbox.io/s/wyq2kzw1yl

All 4 comments

may be related to #4362

to prevent the insertion wrap the first span into an element that isn't removed

<iframe>s will reload whenever they are detached from the document (or after inserting them to a new location). It's definitely better if we try to move other elements around <iframe>s first but this would introduce extra complexity to the existing patching algorithms. React seems to keep the <iframe> alive in similar cases: https://codesandbox.io/s/wyq2kzw1yl

Let's close this in favor of #4362 and https://github.com/vuejs/vue/issues/10331 since their examples are simpler by not dealing with an iframe

Was this page helpful?
0 / 5 - 0 ratings