fix: use displayName since name gets stripped off when uglifying/minifiyng in production (#6036)

fix: use displayName since name gets stripped off when uglifying/minifiy in production
This commit is contained in:
Aakansha Doshi 2022-12-27 15:17:13 +05:30 committed by GitHub
parent 5fcf6a4845
commit c8370b394c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -701,10 +701,11 @@ export const ReactChildrenToObject = <
if ( if (
React.isValidElement(child) && React.isValidElement(child) &&
typeof child.type !== "string" && typeof child.type !== "string" &&
child?.type.name //@ts-ignore
child?.type.displayName
) { ) {
// @ts-ignore // @ts-ignore
acc[child.type.name] = child; acc[child.type.displayName] = child;
} }
return acc; return acc;
}, {} as Partial<T>); }, {} as Partial<T>);