feat(layout): refitEpoch test + implementation LayoutGrid

This commit is contained in:
2026-07-28 19:09:07 +02:00
parent 50219df4e5
commit 5d6a295715
2 changed files with 156 additions and 1 deletions

View File

@ -97,6 +97,11 @@ export function LayoutGrid({
}: LayoutGridProps) {
const vm = useLayout(projectId, layoutId);
const work = useProjectWorkState(projectId);
const [refitEpoch, setRefitEpoch] = useState(0);
useEffect(() => {
setRefitEpoch((epoch) => epoch + 1);
}, [projectId, layoutId, cwd, vm.layoutVersion]);
if (!vm.layout) {
return (
@ -129,6 +134,7 @@ export function LayoutGrid({
projectId={projectId}
workState={work.state}
refreshWorkState={work.refresh}
refitSignal={refitEpoch}
onOpenConversation={onOpenConversation}
onOpenPluginsSettings={onOpenPluginsSettings}
/>
@ -145,6 +151,7 @@ interface NodeViewProps {
projectId: string;
workState: ProjectWorkState | null;
refreshWorkState: () => Promise<void>;
refitSignal: number;
onOpenConversation?: (conversationId: string) => void;
onOpenPluginsSettings?: () => void;
}
@ -157,6 +164,7 @@ function NodeView({
projectId,
workState,
refreshWorkState,
refitSignal,
onOpenConversation,
onOpenPluginsSettings,
}: NodeViewProps) {
@ -190,6 +198,7 @@ function NodeView({
projectId={projectId}
workState={workState}
refreshWorkState={refreshWorkState}
refitSignal={refitSignal}
onOpenConversation={onOpenConversation}
/>
);
@ -202,6 +211,7 @@ function NodeView({
projectId={projectId}
workState={workState}
refreshWorkState={refreshWorkState}
refitSignal={refitSignal}
onOpenConversation={onOpenConversation}
onOpenPluginsSettings={onOpenPluginsSettings}
/>
@ -215,6 +225,7 @@ function NodeView({
projectId={projectId}
workState={workState}
refreshWorkState={refreshWorkState}
refitSignal={refitSignal}
onOpenConversation={onOpenConversation}
onOpenPluginsSettings={onOpenPluginsSettings}
/>
@ -234,6 +245,7 @@ interface LeafViewProps {
projectId: string;
workState: ProjectWorkState | null;
refreshWorkState: () => Promise<void>;
refitSignal: number;
onOpenConversation?: (conversationId: string) => void;
}
@ -315,6 +327,7 @@ function LeafView({
projectId,
workState,
refreshWorkState,
refitSignal,
onOpenConversation,
}: LeafViewProps) {
// A cell can be closed only when it lives inside a (binary) split: closing it
@ -950,7 +963,7 @@ function LeafView({
onSessionId={(sid) => void vm.setSession(id, sid)}
agentMode={agentId != null}
portal={agentId != null ? portal : undefined}
refitSignal={vm.layoutVersion}
refitSignal={refitSignal}
/>
{/* Write-portal overlay (ARCHITECTURE §20.3 step b/e): while a delegation
is being injected into the agent's PTY, a grey veil with a centred
@ -1185,6 +1198,7 @@ interface SplitViewProps {
projectId: string;
workState: ProjectWorkState | null;
refreshWorkState: () => Promise<void>;
refitSignal: number;
onOpenConversation?: (conversationId: string) => void;
onOpenPluginsSettings?: () => void;
}
@ -1196,6 +1210,7 @@ function SplitView({
projectId,
workState,
refreshWorkState,
refitSignal,
onOpenConversation,
onOpenPluginsSettings,
}: SplitViewProps) {
@ -1241,6 +1256,7 @@ function SplitView({
projectId={projectId}
workState={workState}
refreshWorkState={refreshWorkState}
refitSignal={refitSignal}
onOpenConversation={onOpenConversation}
onOpenPluginsSettings={onOpenPluginsSettings}
parentSplit={{
@ -1336,6 +1352,7 @@ interface GridViewProps {
projectId: string;
workState: ProjectWorkState | null;
refreshWorkState: () => Promise<void>;
refitSignal: number;
onOpenConversation?: (conversationId: string) => void;
onOpenPluginsSettings?: () => void;
}
@ -1347,6 +1364,7 @@ function GridView({
projectId,
workState,
refreshWorkState,
refitSignal,
onOpenConversation,
onOpenPluginsSettings,
}: GridViewProps) {
@ -1388,6 +1406,7 @@ function GridView({
projectId={projectId}
workState={workState}
refreshWorkState={refreshWorkState}
refitSignal={refitSignal}
onOpenConversation={onOpenConversation}
onOpenPluginsSettings={onOpenPluginsSettings}
/>