mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-11 20:27:44 +02:00
[eric] share: flush the dashboard layout before export so a just-added app/agent card isn't missed (debounced save was stale)
This commit is contained in:
@@ -180,6 +180,8 @@ const DashboardCanvas: React.FC<DashboardCanvasProps> = ({
|
||||
cards={cards}
|
||||
viewCards={viewCards}
|
||||
browserCards={browserCards}
|
||||
notes={notes}
|
||||
expandedSessionIds={expandedSessionIds}
|
||||
outputs={outputs}
|
||||
dashboardId={dashboardId}
|
||||
canvasActions={canvas.actions}
|
||||
|
||||
@@ -6,10 +6,12 @@ import GridViewRoundedIcon from '@mui/icons-material/GridViewRounded';
|
||||
import LanguageIcon from '@mui/icons-material/Language';
|
||||
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
||||
import { useClaudeTokens } from '@/shared/styles/ThemeContext';
|
||||
import { useAppDispatch } from '@/shared/hooks';
|
||||
import DashboardGlyph from './DashboardGlyph';
|
||||
import ShareButton from '@/app/components/share/ShareButton';
|
||||
import type { AgentSession } from '@/shared/state/agentsSlice';
|
||||
import type { CardPosition, ViewCardPosition, BrowserCardPosition } from '@/shared/state/dashboardLayoutSlice';
|
||||
import { saveLayout } from '@/shared/state/dashboardLayoutSlice';
|
||||
import type { CardPosition, ViewCardPosition, BrowserCardPosition, NotePosition } from '@/shared/state/dashboardLayoutSlice';
|
||||
import type { Output } from '@/shared/state/outputsSlice';
|
||||
import type { CanvasActions } from '../hooks/interaction/useCanvasControls';
|
||||
import { friendlyStatusLabel } from '@/shared/statusLabel';
|
||||
@@ -20,6 +22,8 @@ interface DashboardHeaderProps {
|
||||
cards: Record<string, CardPosition>;
|
||||
viewCards: Record<string, ViewCardPosition>;
|
||||
browserCards: Record<string, BrowserCardPosition>;
|
||||
notes: Record<string, NotePosition>;
|
||||
expandedSessionIds: string[];
|
||||
outputs: Record<string, Output>;
|
||||
dashboardId: string | undefined;
|
||||
canvasActions: CanvasActions;
|
||||
@@ -41,12 +45,15 @@ const DashboardHeader: React.FC<DashboardHeaderProps> = ({
|
||||
cards,
|
||||
viewCards,
|
||||
browserCards,
|
||||
notes,
|
||||
expandedSessionIds,
|
||||
outputs,
|
||||
dashboardId,
|
||||
canvasActions,
|
||||
onHighlightCard,
|
||||
}) => {
|
||||
const c = useClaudeTokens();
|
||||
const dispatch = useAppDispatch();
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
@@ -158,6 +165,13 @@ const DashboardHeader: React.FC<DashboardHeaderProps> = ({
|
||||
<ShareButton
|
||||
target={{ kind: 'dashboard', id: dashboardId, name: dashboardName || 'Dashboard' }}
|
||||
iconFontSize={15}
|
||||
onOpen={() => {
|
||||
// Layout saves are debounced, so a just-added app/agent card may
|
||||
// not be on disk yet. The export reads disk, flush the live
|
||||
// layout now so Share captures the current board, not a stale one.
|
||||
if (!dashboardId) return;
|
||||
dispatch(saveLayout({ dashboardId, cards, viewCards, browserCards, notes, expandedSessionIds }));
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user