[eric] browser: persist browser-card dashboard_id so cards keep their home and stop bleeding across dashboards

This commit is contained in:
ciregenz
2026-06-26 03:00:44 -07:00
parent 9d6abc7091
commit 22649ba377
2 changed files with 4 additions and 1 deletions
+2
View File
@@ -40,6 +40,8 @@ class BrowserCardPosition(BaseModel):
spawned_by: Optional[str] = None
# When the agent leaves the deliverable on the page (a video playing, a page to read), it sets this so the frontend's auto-close on parent finish skips the card and the browser stays put.
keep_open: bool = False
# The dashboard this card calls home. Persisted so the home survives a save; without it the card reloads untagged and renders on EVERY dashboard (the cross-dashboard bleed).
dashboard_id: Optional[str] = None
class NotePosition(BaseModel):
@@ -1344,8 +1344,9 @@ const dashboardLayoutSlice = createSlice({
// Merge, don't replace: the keep-alive browser cards resetLayout preserved are ALREADY in state.browserCards with their webContents live. Keep them and add this dashboard's saved cards on top; on overlap (switching back to their own dashboard) the live data wins so the mounted webview isn't disturbed.
const keptAlive = state.browserCards;
const incoming = action.payload.browserCards;
// Default a missing home to the dashboard we're loading (legacy/untagged cards), but DON'T overwrite a real persisted home: a card saved here yet owned elsewhere is leftover from the old untagged-shows-everywhere bug, leaving its true home lets it park off-screen and get cleaned on the next save instead of bleeding.
for (const card of Object.values(incoming)) {
card.dashboard_id = ownerDashboardId;
if (!card.dashboard_id) card.dashboard_id = ownerDashboardId;
}
// New cards boot parked (no guest process, title placeholder); the suspend hook wakes viewport-sized and agent-driven ones on its first pass. NEVER re-park a live keep-alive card, that snapshot-swap would kill its session.
for (const id of Object.keys(incoming)) {