[fix] undefined parent_component in Component.ts

This change fixes an issue in Component.ts where an error occurs when the parent_component parameter is undefined, causing the following error: "Cannot read properties of undefined (reading '$$')".

The proposed solution is to add a null check to the parent_component parameter before accessing the $$ property. 

This change ensures that the code works even when parent_component is not defined, as is the case when importing a module dynamically.
pull/8295/head
Pierre CM 4 years ago committed by GitHub
parent 5a3a1e488a
commit be0ef10d4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -97,7 +97,7 @@ export function init(component, options, instance, create_fragment, not_equal, p
callbacks: blank_object(),
dirty,
skip_bound: false,
root: options.target || parent_component.$$.root
root: options.target || parent_component?.$$.root
};
append_styles && append_styles($$.root);

Loading…
Cancel
Save