diff --git a/public/hooks/use_patch_fixed_style.ts b/public/hooks/use_patch_fixed_style.ts index dc240853..db9ba953 100644 --- a/public/hooks/use_patch_fixed_style.ts +++ b/public/hooks/use_patch_fixed_style.ts @@ -31,8 +31,12 @@ export const usePatchFixedStyle = () => { }); return () => { subscription.unsubscribe(); + document.head.removeChild(style); + if (textRef.current) { + style.removeChild(textRef.current); + } }; - }, []); + }, [sidecarConfig$]); }; function updateHeadStyle(config: ISidecarConfig, text?: Text) {