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): support for nested calls to runWithContext #10261

Merged
merged 1 commit into from Feb 7, 2024

Conversation

yangxiuxiu1115
Copy link
Contributor

fix #10260

Copy link

github-actions bot commented Feb 2, 2024

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 90.2 kB (+8 B) 34.4 kB (+6 B) 30.9 kB (+5 B)
vue.global.prod.js 147 kB (+8 B) 53.6 kB (+6 B) 47.9 kB (+112 B)

Usages

Name Size Gzip Brotli
createApp 50.4 kB (+8 B) 19.7 kB (+2 B) 18 kB (+1 B)
createSSRApp 53.7 kB (+8 B) 21 kB (+3 B) 19.2 kB (+53 B)
defineCustomElement 52.6 kB (+8 B) 20.4 kB (+2 B) 18.6 kB (+11 B)
overall 64.1 kB (+8 B) 24.8 kB (+4 B) 22.5 kB (+6 B)

@so1ve
Copy link
Member

so1ve commented Feb 3, 2024

What if user does:

app.runWithContext(() => {
  app.runWithContext(() => {
    app.runWithContext(() => {
    })
    inject('foo')
  })
  return inject('foo')
})

I think you should use a stack

@yangxiuxiu1115
Copy link
Contributor Author

I tested this case locally and it passed.

@yyx990803
Copy link
Member

@so1ve lastApp is saved in the closures in a call stack :)

@yyx990803 yyx990803 merged commit 75e02b5 into vuejs:main Feb 7, 2024
11 checks passed
@yangxiuxiu1115 yangxiuxiu1115 deleted the fix/runWithContext branch February 9, 2024 04:35
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.

Nested calls to runWithContext resets the app for the rest of the top runWithContext call
3 participants