Skip to content

Commit 7d008f7

Browse files
committed
inspect a shallow copy
1 parent cda077c commit 7d008f7

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

packages/shell-api/src/deep-inspect-service-provider-wrapper.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,9 @@ function customDocumentInspect(
234234
};
235235

236236
// reuse the standard inpect logic for an object without causing infinite
237-
// recursion
238-
const inspectBackup = (this as any)[customInspectSymbol];
239-
delete (this as any)[customInspectSymbol];
240-
const result = inspect(this, newInspectOptions);
241-
(this as any)[customInspectSymbol] = inspectBackup;
242-
return result;
237+
const copyToInspect: any = Array.isArray(this) ? this.slice() : { ...this };
238+
delete copyToInspect[customInspectSymbol];
239+
return inspect(copyToInspect, newInspectOptions);
243240
}
244241

245242
function addCustomInspect(obj: any) {

0 commit comments

Comments
 (0)