-
-
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(runtime-core): setRef should not update setupState's TemplateRef #11810
Changes from 14 commits
610e879
d22b9e0
5a35e00
054bd90
51fee9a
17ae4d6
25e93b7
15284f4
ed70d56
ad61944
e127bdb
9801856
532bdd4
3c75efd
3bc3c1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -940,6 +940,11 @@ export function handleSetupResult( | |
} | ||
instance.setupState = proxyRefs(setupResult) | ||
if (__DEV__) { | ||
// dev only | ||
Object.defineProperty(setupResult, '__v__setupResult', { | ||
enumerable: false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the default value of |
||
value: setupResult, | ||
}) | ||
exposeSetupStateOnRenderContext(instance) | ||
} | ||
} else if (__DEV__ && setupResult !== undefined) { | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -8,6 +8,8 @@ export function useTemplateRef<T = unknown, Keys extends string = string>( | |||||
): Readonly<ShallowRef<T | null>> { | ||||||
const i = getCurrentInstance() | ||||||
const r = shallowRef(null) | ||||||
// @ts-expect-error | ||||||
r.__v__TemplateRef = true | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to modify it like this before, but it caused the problem mentioned in #11816 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
if (i) { | ||||||
const refs = i.refs === EMPTY_OBJ ? (i.refs = {}) : i.refs | ||||||
|
||||||
|
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.