fix(richtext-lexical): error when loading lexical without custom config (so it uses the defaultSanitizedServerEditorConfig), due to error in the cloneDeep function which clones react components. Now, it doesn't clone them anymore.

This commit is contained in:
Alessio Gravili
2024-03-07 18:48:07 -05:00
parent a7c5e4f317
commit f956558656

View File

@@ -37,6 +37,10 @@ export function cloneDeep<T>(object: T, cache: WeakMap<any, any> = new WeakMap()
// Handle Array and Object
if (typeof object === 'object' && object !== null) {
if ('$$typeof' in object && typeof object.$$typeof === 'symbol') {
return object
}
const clonedObject: any = Array.isArray(object)
? []
: Object.create(Object.getPrototypeOf(object))