mirror of https://github.com/vuejs/core.git
fix: do not warn Symbol.unscopables access
This commit is contained in:
parent
ae97e50538
commit
ef292a8d90
|
@ -443,7 +443,7 @@ describe('component: proxy', () => {
|
|||
).not.toHaveBeenWarned()
|
||||
})
|
||||
|
||||
test('should allow symbol to access on render', () => {
|
||||
test('should not warn Symbol.unscopables access on render', () => {
|
||||
const Comp = {
|
||||
render() {
|
||||
if ((this as any)[Symbol.unscopables]) {
|
||||
|
@ -460,7 +460,7 @@ describe('component: proxy', () => {
|
|||
`Property ${JSON.stringify(
|
||||
Symbol.unscopables,
|
||||
)} was accessed during render ` + `but is not defined on instance.`,
|
||||
).toHaveBeenWarned()
|
||||
).not.toHaveBeenWarned()
|
||||
})
|
||||
|
||||
test('should prevent mutating script setup bindings', () => {
|
||||
|
|
|
@ -308,7 +308,14 @@ const hasSetupBinding = (state: Data, key: string) =>
|
|||
state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key)
|
||||
|
||||
export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
|
||||
get({ _: instance }: ComponentRenderContext, key: string) {
|
||||
get(
|
||||
{ _: instance }: ComponentRenderContext,
|
||||
key: string | typeof Symbol.unscopables,
|
||||
) {
|
||||
if (key === Symbol.unscopables) {
|
||||
return
|
||||
}
|
||||
|
||||
if (key === ReactiveFlags.SKIP) {
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue