Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(preview): only re-target the previewed channel when the selection changes (#4733)

gbirmanf96eb10ffda9
diff --git a/js/app/packages/app/component/PreviewPanel.tsx b/js/app/packages/app/component/PreviewPanel.tsx
index c843e2980a..e6d087d672 100644
--- a/js/app/packages/app/component/PreviewPanel.tsx
+++ b/js/app/packages/app/component/PreviewPanel.tsx
@@ -14,8 +14,10 @@ import {
import { createContextProvider } from '@solid-primitives/context';
import {
type Component,
+ createMemo,
createRenderEffect,
createSignal,
+ on,
Show,
Suspense,
} from 'solid-js';
@@ -115,19 +117,16 @@ const PreviewPanelContent: Component<NonNullableFields<PreviewPanel>> = (
};
const [interactedWith, setInteractedWith] = createSignal(false);
- createRenderEffect((prevId: string) => {
- const id = props.selectedEntity.id;
- if (id !== prevId) {
- setInteractedWith(false);
- }
-
- void navigateChannelEntityToTarget(
- props.selectedEntity,
- props.orchestrator
- );
+ // Key on the id: the entity object is live, and unrelated notification
+ // churn must not re-target the previewed channel.
+ const selectedEntityId = createMemo(() => props.selectedEntity.id);
- return id;
- }, props.selectedEntity.id);
+ createRenderEffect(
+ on(selectedEntityId, () => {
+ setInteractedWith(false);
+ navigateChannelEntityToTarget(props.selectedEntity, props.orchestrator);
+ })
+ );
createRenderEffect(() => {
// noop: previously we constrained toolbarLeft width based on the main split's