Subscribe on changes!

Problems with using keepAlive with Teleport

avatar
Jun 6th 2023

Vue version

3.2.45

Link to minimal reproduction

https://play.vuejs.org/#eNqlU01vm0AQ/SsTLmtLsWmlnhxj1eTSHHpqpR5KDxjW9sr7JXahQYj/ntmFtUGJckhO7My8efPxhi7aa71uahptoq0pKqYtGGprvcskABNaVRY6qOgRejhWSgBBMHmYRB+V0Psxto695QhfYdIZJg0YhyqUNBaEOUHiSi3ID8q5gj+q4uUdWXqmAcPMr7P6vx9xtqrpNPqzddRj0HcyjSr5eM7liWJ8sYRkB52LYY8D57rJee2CdzOHJ0DQERYz/zKkw1j2mu8Lj2k9UG7ou9A0QN2nR2MbD0KgBGhYKjTPLfWCbEvWQMFzYxLC81bVlng/Rs5fd13nd9j32xgtjz/U1ioJ3wvOikuSRWEHWQTGtpyiq2QGC7QbOHBVXB5A5NWJydVBYabYwLcv+jmLhiK7wie7rj17PNAPpS6U6lXOWUNhw2TB69Kx/yV+HeQe/CMl/7IotFygQ0kqLSYYxA7LwdbigTG+UY4OHN+/3JImi4nuo+vdfeCQr+cX7oqc/f09QS5gD78ppz7dX+J76jCpawvNSqiSchzIUd7GQU2eCBLe1LkyW5WQgyrboGbQ0xFM5YxDBppvbcD/VZ/ZQDrfQPqRkdNXI6fjBPOW+xdoD3Zd

Steps to reproduce

When I set keepAlive on an A subcomponent and a Teleport component is mounted on the outermost body, the dom element inside the Teleport component still exists on the page when I switch to another B subcomponent

What is expected?

I want to know if this is the keepAlive mechanism or if it is an undetected bug

What is actually happening?

This will affect my ability to switch pages in the system. Of course, there are solutions, but it seems not ideal enough

System Info

No response

Any additional comments?

No response

avatar
Jun 6th 2023

I don't think it's a bug, if remove the content that would be a breaking change. you can remove content by disabling the teleport. see

avatar
Jun 8th 2023

I don't think it's a bug, if remove the content that would be a breaking change. you can remove content by disabling the teleport. see

I understand your idea, but this situation seems to leak the data of hidden components (although it doesn't cause much trouble for development). I'm not sure if this situation should be understood as a feature or a bug

avatar
Jun 8th 2023

I don't think it's a bug, if remove the content that would be a breaking change. you can remove content by disabling the teleport. see

I don't think it's a bug, if remove the content that would be a breaking change. you can remove content by disabling the teleport. see

I understand your idea, but this situation seems to leak the data of hidden components (although it doesn't cause much trouble for development). I'm not sure if this situation should be understood as a feature or a bug

and the document states that using a report does not affect the hierarchical relationship between components, so it still has a parent-child relationship with the hidden component. Should the hidden parent component and the hidden child component also be hidden using-with-components

avatar
Jun 22nd 2023
avatar
Jun 26th 2023

duplicate? github.com/vuejs/core/issues/5603

I think so

avatar
Sep 12th 2023

duplicate of #5603