Skip to content

Commit 4f57db8

Browse files
committed
fix(plugin-vue): HMR throw Maximum call stack size exceeded (fix #325)
1 parent 0a3b9a5 commit 4f57db8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/plugin-vue/src/handleHotUpdate.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,14 @@ export function isOnlyTemplateChanged(
202202
)
203203
}
204204

205-
function deepEqual(obj1: any, obj2: any, excludeProps: string[] = []): boolean {
205+
function deepEqual(obj1: any, obj2: any, excludeProps: string[] = [], deepParentsOfObj1: any[] = []): boolean {
206206
// Check if both objects are of the same type
207207
if (typeof obj1 !== typeof obj2) {
208208
return false
209209
}
210210

211211
// Check if both objects are primitive types or null
212-
if (obj1 == null || obj2 == null || typeof obj1 !== 'object') {
212+
if (obj1 == null || obj2 == null || typeof obj1 !== 'object' || deepParentsOfObj1.includes(obj1)) {
213213
return obj1 === obj2
214214
}
215215

@@ -229,7 +229,7 @@ function deepEqual(obj1: any, obj2: any, excludeProps: string[] = []): boolean {
229229
continue
230230
}
231231

232-
if (!deepEqual(obj1[key], obj2[key], excludeProps)) {
232+
if (!deepEqual(obj1[key], obj2[key], excludeProps, [...deepParentsOfObj1, obj1])) {
233233
return false
234234
}
235235
}

0 commit comments

Comments
 (0)