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

fix(runtime-core): Teloport in keepalive should be cached #11413

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

linzhe141
Copy link
Contributor

@linzhe141 linzhe141 commented Jul 21, 2024

Copy link

github-actions bot commented Jul 21, 2024

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 90.5 kB (+470 B) 34.6 kB (+116 B) 31.2 kB (+159 B)
vue.global.prod.js 147 kB (+470 B) 54.1 kB (+135 B) 48.1 kB (+85 B)

Usages

Name Size Gzip Brotli
createApp 49.8 kB 19.5 kB 17.8 kB
createSSRApp 53.3 kB 21 kB 19.1 kB
defineCustomElement 52 kB 20.3 kB 18.5 kB
overall 63.6 kB (+396 B) 24.7 kB (+123 B) 22.4 kB (+51 B)

@edison1105
Copy link
Member

edison1105 commented Jul 22, 2024

Why not reuse moveTeleport?

Suggestions

Implement active and deactive inside TeleportImpl, and reuse moveTeleport within these methods.

export const TeleportImpl {
    //...
	active: activeTeleport
	deactive: deactiveTeleport
}

function activeTeleport(...){
	// try reuse moveTeleport
}
function deactiveTeleport(...){
	// try reuse moveTeleport
}

in KeepAlive

// active
(vnode.type as typeof TeleportImpl).active(...)

// deactive
(vnode.type as typeof TeleportImpl).deactive(...)

@linzhe141
Copy link
Contributor Author

Why not reuse moveTeleport?

Suggestions

Implement active and deactive inside TeleportImpl, and reuse moveTeleport within these methods.

export const TeleportImpl {
    //...
	active: activeTeleport
	deactive: deactiveTeleport
}

function activeTeleport(...){
	// try reuse moveTeleport
}
function deactiveTeleport(...){
	// try reuse moveTeleport
}

in KeepAlive

// active
(vnode.type as typeof TeleportImpl).active(...)

// deactive
(vnode.type as typeof TeleportImpl).deactive(...)

Thanks for your review, I will try to modify it.

@@ -977,4 +979,59 @@ describe('KeepAlive', () => {
expect(mountedB).toHaveBeenCalledTimes(1)
expect(unmountedB).toHaveBeenCalledTimes(0)
})

// #11410
test('teloport in keepalive should be cached', async () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small typo, teloport > teleport

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

Successfully merging this pull request may close these issues.

<Teleport> content not be removed on onDeactivated & not re-insert on onActivated
3 participants