Open miroljub1995 opened 1 week ago
The current usage is not reasonable because the <div>
inside the <Transition>
does not undergo any insertions or removals, thus the transition animation will not be triggered. This scenario can be considered an edge case.
@edison1105 I think the priority of this should be increased, because although the usage described is anomalous, toggling between VNodes it's an usual behaviour and actually encouraged (like in Vue Router). See this playground:
In fact, #12182 doesn't fix my case
@ferferga Thank you for providing the demo. I acknowledge that there is a memory issue present. However, it is important to note that the memory usage and detached DOM nodes do not continuously grow and eventually stabilize. Therefore, it does not strictly qualify as a memory leak.
fixed via https://github.com/vuejs/core/pull/12182/commits/ec2fcec0899056672ca9c32fc2ea0730fb3f0365 Please feel free to review.
@edison1105 Thank you very much as always!
That commit does indeed fix the issue if I introduce a copy of ChildEmpty at the end of the toggling cycle.
However, even if it's not technically a leak as you mention, it's (in my opinion) not an efficient usage of resources either and a behaviour people would expect to belong to KeepAlive. Not sure if there's a known room for improvement here but you just tried to fix the leak or you're not sure how to properly improve this.
Vue version
3.5.12
Link to minimal reproduction
https://play.vuejs.org/#eNqVU9uO0zAQ/ZXBL0mlkhQKLyUtLKuVgAdAbCVeLFUhdVrvOo5lO21RlG/go/gxxnbSbREqu1JuM+d4fMZz0pIrpZJdw8iMZKbQXFkwzDZqQSWvVK0ttKBZCR2Uuq4gQmp0hK63XKx7IEl95GpFb46M7zpXiunAoSRJ+4SjUYI8KotaGtx0W+8lzN1ecZkLw0YIZmmQhGIwsKxSIrcMI4DsR2NtLeFdIXhxP6dkKPDMf1CyaNu+6FuIPvA1i2AG0S1mIui6LA3rQ61elA8wDG3tnvNyqEsJpAO65jvEGEpcZCkGocTQGEZZeqKUjIk12GLJN8mdqSWec+sWUFLUleKC6S/KcjwCSmbgEYflQtT7Tz5ndcPGQ77YsuL+H/k7c3A5Sr5qZpje4dkeMZvrDbMBvrn9zA74fQSret0IZF8AvzFTi8ZpDLT3jVyj7BOeV/vRD5zLzdLcHCyTZmjKCXXMzvMpwclfX2j9Qe40eeXXUdnhKR7d9Uin+o0oeXCYZfgIBpNsD1da5z/j6WQ1mfh7lJRciBjfVa7ieDUGPoL5AuIWOHSj0X/8GIyxWG65AbwKpxa7av22iWByY7fed8Exf3vk5Ld4en+XfpOlznEU7pjP/eu97UdDegAhI2qLpvavnn3i8LNSZw38/oUtrHZMu6Gj/mnyOnnxknR/AOXRc60=
Steps to reproduce
Open Memory tab in dev tools and just click
Show
andHide
multiple times.What is expected?
After
Hide
andCollect Gargabe
memory should be reclaimed to around 100MB.What is actually happening?
Memory allocation is continuously increasing without any notable decrease after
Hide
andCollect Gargabe
. If I removeTransition
, everything works okay.System Info
Any additional comments?
No response