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(ssr): clone node support Set and Map #9983

Merged
merged 4 commits into from
Jan 4, 2024
Merged

Conversation

edison1105
Copy link
Member

close #9981

Copy link

github-actions bot commented Jan 4, 2024

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 89.4 kB 34 kB 30.7 kB
vue.global.prod.js 146 kB 53.3 kB 47.6 kB

Usages

Name Size Gzip Brotli
createApp 49.7 kB 19.5 kB 17.8 kB
createSSRApp 53.1 kB 20.8 kB 19 kB
defineCustomElement 52 kB 20.2 kB 18.5 kB
overall 63.2 kB 24.4 kB 22.2 kB

@yyx990803
Copy link
Member

The original clone logic was causing issue because it clones Set into empty objects, but since scopeIds is the only thing and it doesn't need to be cloned, the simpler fix is to make sure the object clone logic only applies to real plain objects (a4bcbe8). Set and Map can be reused as-is assuming they are immutable on the ASTs.

Also, there are faster ways to clone Sets and Maps, because both are iterable and both accept interables as the constructor argument:

const clonedSet = new Set(originalSet)
const clonedMap = new Map(originalMap)

@yyx990803 yyx990803 merged commit 7dbdb3e into vuejs:main Jan 4, 2024
11 checks passed
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.

In Astro SSG, scoped slots are breaking the build
3 participants