Skip to content

Commit 4027a76

Browse files
committed
fix: destroy composition live control properly
1 parent c00977e commit 4027a76

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

scopes/compositions/compositions/ui/compositions-panel/compositions-panel.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ export function CompositionsPanel({
5050
}: CompositionsPanelProps) {
5151
// setup from props
5252
const shouldAddNameParam = useNameParam || (isScaling && includesEnvTemplate === false);
53-
const handleSelect = useCallback(
54-
(selected: Composition) => {
55-
onSelect && onSelect(selected);
56-
},
57-
[onSelect]
58-
);
5953

6054
// current composition state
6155
const location = useLocation();
@@ -70,6 +64,13 @@ export function CompositionsPanel({
7064
const [mounter, setMounter] = useState<Window>();
7165

7266
// composition navigation action
67+
const handleSelect = useCallback(
68+
(selected: Composition) => {
69+
onSelect && onSelect(selected);
70+
setControlsTimestamp(0);
71+
},
72+
[onSelect]
73+
);
7374
const onCompositionCodeClicked = useCallback(
7475
(composition: Composition) => (e: React.MouseEvent<HTMLDivElement>) => {
7576
e.preventDefault();
@@ -95,6 +96,8 @@ export function CompositionsPanel({
9596
setConsolesValues(values);
9697
setControlsTimestamp(timestamp);
9798
}
99+
// LATER
100+
// function onLiveControlsDestroy(e: MessageEvent<LiveControlReadyEventData>) {}
98101
window.addEventListener('message', onLiveControlsSetup);
99102
return () => {
100103
window.removeEventListener('message', onLiveControlsSetup);

0 commit comments

Comments
 (0)