[chore] rework useObservable hook to properly re-subsrive when the state change

This commit is contained in:
MathieuG-P
2024-01-07 16:22:51 +01:00
parent cc42f0a978
commit c54185b348
32 changed files with 93 additions and 75 deletions
@@ -32,7 +32,7 @@ export const BsContentTabItem: BsContentTabItemComponent = ({ text, icon: Icon,
{linkProps && (
<div className="flex items-center absolute top-1.5 left-1.5">
<LinkButton
state$={linkProps.state$}
state={linkProps.state}
className={linkProps.className ?? "block w-6 h-6 aspect-square blur-0 cursor-pointer hover:brightness-75"}
title={linkProps.title}
onClick={linkProps.onClick}
@@ -8,7 +8,7 @@ import { LinkOpenerService } from "renderer/services/link-opener.service";
export function BsmIframeView() {
const linkService = useService(LinkOpenerService);
const iframeUrl = useObservable(linkService.iframeLink$);
const iframeUrl = useObservable(() => linkService.iframeLink$);
const ref = useRef(null);
useClickOutside(ref, () => linkService.closeIframe());