| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -150,7 +150,7 @@ function mockReactivityDeep(obj: any, seen = new Set()) { | |||
| 150 | 150 | ) { | |
| 151 | 151 | continue | |
| 152 | 152 | } | |
| 153 | - mockReactivityDeep(value) | ||
| 153 | + mockReactivityDeep(value, seen) | ||
| 154 | 154 | } | |
| 155 | 155 | } | |
| 156 | 156 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,10 +11,14 @@ import { | |||
| 11 | 11 | isRef, | |
| 12 | 12 | set, | |
| 13 | 13 | shallowRef, | |
| 14 | + getCurrentInstance, | ||
| 15 | + nextTick, | ||
| 14 | 16 | } from '../../src' | |
| 15 | 17 | import { createRenderer } from 'vue-server-renderer' | |
| 18 | + import { mockWarn } from '../helpers' | ||
| 16 | 19 | ||
| 17 | 20 | describe('SSR Reactive', () => { | |
| 21 | + mockWarn(true) | ||
| 18 | 22 | beforeEach(() => { | |
| 19 | 23 | process.env.VUE_ENV = 'server' | |
| 20 | 24 | }) | |
@@ -118,4 +122,27 @@ describe('SSR Reactive', () => { | |||
| 118 | 122 | set(state.value, 'new', ref(true)) | |
| 119 | 123 | expect(JSON.stringify(state.value)).toBe('{"old":false,"new":true}') | |
| 120 | 124 | }) | |
| 125 | + | ||
| 126 | + // test the input parameter of mockReactivityDeep | ||
| 127 | + it('ssr should not RangeError: Maximum call stack size exceeded', async () => { | ||
| 128 | + new Vue({ | ||
| 129 | + setup() { | ||
| 130 | + // @ts-expect-error | ||
| 131 | + const app = getCurrentInstance().proxy | ||
| 132 | + let mockNt: any = [] | ||
| 133 | + mockNt.__ob__ = {} | ||
| 134 | + const test = reactive({ | ||
| 135 | + app, | ||
| 136 | + mockNt, | ||
| 137 | + }) | ||
| 138 | + return { | ||
| 139 | + test, | ||
| 140 | + } | ||
| 141 | + }, | ||
| 142 | + }) | ||
| 143 | + await nextTick() | ||
| 144 | + expect( | ||
| 145 | + `"RangeError: Maximum call stack size exceeded"` | ||
| 146 | + ).not.toHaveBeenWarned() | ||
| 147 | + }) | ||
| 121 | 148 | }) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments