fix(board): harden grid edit transitions

This commit is contained in:
Thomas Camlong committed 2026-08-21 15:49:10 +02:00
1 parent 5cd627d66c
commit 59b6f08a36
7 files changed
+135 -43

No files matched your search

@@ -32,6 +32,7 @@ import { startAdvancedFocusEntrance } from "../advanced-focus/entrance";
import { getAdvancedFocusClosePosition, getAdvancedFocusRect } from "../advanced-focus/geometry";
import { AdvancedFocusManualSurface } from "../advanced-focus/manual-surface";
import { redirectShiftWheel } from "../advanced-focus/wheel";
import { useBoardGridPortalHost } from "../sections/grid/grid-portal-host";
import classes from "../sections/item.module.css";
import { useItemActions } from "./item-actions";
import itemContentClasses from "./item-content.module.css";
@@ -105,8 +106,8 @@ const WidgetDefinitionLoadError = ({
export const BoardItemContent = ({ item }: BoardItemContentProps) => {
const { ref, width: measuredWidth, height: measuredHeight } = useElementSize<HTMLDivElement>();
const widgetStateRef = useRef<Record<string, unknown> | null>(null);
const widgetRuntimeRef = useRef(createWidgetRuntimeState());
const { getEntryRuntime } = useBoardGridPortalHost();
const { widgetStateRef, widgetRuntimeRef } = getEntryRuntime(item.id, createBoardItemRuntime);
const width = measuredWidth || getLogicalTrackSize(item.width);
const height = measuredHeight || getLogicalTrackSize(item.height);
@@ -137,6 +138,11 @@ export const BoardItemContent = ({ item }: BoardItemContentProps) => {
);
};
const createBoardItemRuntime = () => ({
widgetStateRef: { current: null } as MutableRefObject<Record<string, unknown> | null>,
widgetRuntimeRef: { current: createWidgetRuntimeState() } as WidgetRuntimeRef,
});
interface LoadedBoardItemContentProps {
item: SectionItem;
width: number;