-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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(reactive): markRaw function return the value directly when it has been marked #11864
Conversation
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a test case for this?
Currently there's a typo in the PR title, markRow
.
packages/reactivity/src/reactive.ts
Outdated
@@ -405,6 +405,7 @@ export type Raw<T> = T & { [RawSymbol]?: true } | |||
* @see {@link https://vuejs.org/api/reactivity-advanced.html#markraw} | |||
*/ | |||
export function markRaw<T extends object>(value: T): Raw<T> { | |||
if (hasOwn(value, ReactiveFlags.SKIP)) return value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps merge this check into the if
below, rather than duplicating the return value
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
Closes: #11862