sweep the dead code in section 8
Each item re-verified before deleting; three of the ten entries were stale
and are corrected in place rather than silently fixed.
- WorkspaceLayout's isMobile/mobilePanelId/onMobileBack: none of its ten
callers set them, so the mobile collapse they fed was permanently off in
that renderer. WorkspaceView passes the same props to WorkspaceRenderer
itself, where they are live.
- fixedHeight on AppRegistryEntry, and getFixedHeight with it: no app has
ever declared one, so it only contributed undefined. The flex-column
branch it shared with fitContent stays, keyed on fitContent alone.
- getDefaults: getAllDashboardState already folds the defaults row into the
one payload the client fetches, which is why it never got a caller.
- upsertScreen's terminals/hostTerminals: never read is right, never
written was not — it inserted them, which is why all 15 rows hold {}.
The columns are left in place; dropping them needs a db:push, and this
tree holds another agent's uncommitted schema file.
- SELECTED_DASHBOARD_KEY: H2 (01365cb) replaced it with ?selected= four
months ago and it has had no reader since.
- ui/sidebar.tsx and the stray ui/hooks/ beside it. use-mobile was not
orphaned as claimed — the sidebar imported it — and the use-toast in
there was a near-identical copy of the live one.
- findChildById's unreachable duplicate condition, and the doc comment that
described the wrong behaviour rather than the code being wrong.
Left deliberately: DragOverlay/LayoutEditor (gated on 5.3, an owner
decision) and the two chat-owned channels, whose docs are fixed here even
though the publishers are not mine to delete.
This commit is contained in:
@@ -61,7 +61,6 @@ export {
|
||||
setDashboardPanelState,
|
||||
upsertScreen,
|
||||
deleteScreen,
|
||||
getDefaults,
|
||||
upsertDefaults,
|
||||
setDefaultsPanelState,
|
||||
} from './queries/dashboards';
|
||||
|
||||
@@ -152,18 +152,20 @@ export async function deleteDashboard(userId: number, id: string): Promise<void>
|
||||
|
||||
// ── Screen CRUD ──
|
||||
|
||||
// No `terminals`/`hostTerminals` here, unlike `UpsertDefaultsData` below. A screen's terminal state
|
||||
// resolves to the `-default` key — the `dashboard_defaults` row — so the two same-named columns on
|
||||
// `screens` have never been read by anything, and the only caller (`api/dashboards`) has never passed
|
||||
// them: every one of the 15 rows holds the `{}` the column default wrote. The columns still exist; they
|
||||
// are not dropped here because `db:push` diffs the whole schema and there is another agent's uncommitted
|
||||
// schema file in this tree.
|
||||
type UpsertScreenData = {
|
||||
layout?: unknown;
|
||||
terminals?: unknown;
|
||||
hostTerminals?: unknown;
|
||||
};
|
||||
|
||||
export async function upsertScreen(userId: number, name: string, data: UpsertScreenData): Promise<void> {
|
||||
const now = new Date();
|
||||
const set: Record<string, unknown> = { updatedAt: now };
|
||||
if (data.layout !== undefined) set.layout = data.layout;
|
||||
if (data.terminals !== undefined) set.terminals = data.terminals;
|
||||
if (data.hostTerminals !== undefined) set.hostTerminals = data.hostTerminals;
|
||||
|
||||
await db
|
||||
.insert(screens)
|
||||
@@ -171,8 +173,6 @@ export async function upsertScreen(userId: number, name: string, data: UpsertScr
|
||||
userId,
|
||||
name,
|
||||
layout: (data.layout ?? null) as never,
|
||||
terminals: (data.terminals ?? {}) as never,
|
||||
hostTerminals: (data.hostTerminals ?? {}) as never,
|
||||
updatedAt: now,
|
||||
})
|
||||
.onConflictDoUpdate({
|
||||
@@ -192,11 +192,9 @@ type UpsertDefaultsData = {
|
||||
hostTerminals?: unknown;
|
||||
};
|
||||
|
||||
export async function getDefaults(userId: number): Promise<{ terminals: unknown; hostTerminals: unknown }> {
|
||||
const [row] = await db.select().from(dashboardDefaults).where(eq(dashboardDefaults.userId, userId));
|
||||
return { terminals: row?.terminals ?? {}, hostTerminals: row?.hostTerminals ?? {} };
|
||||
}
|
||||
|
||||
// No `getDefaults`. Nothing read the defaults row on its own: `getAllDashboardState` above already folds
|
||||
// it into the one state payload the client fetches, which is why the single-row getter never acquired a
|
||||
// caller. `upsertDefaults` below is live (`api/dashboards`).
|
||||
export async function upsertDefaults(userId: number, data: UpsertDefaultsData): Promise<void> {
|
||||
const now = new Date();
|
||||
const set: Record<string, unknown> = { updatedAt: now };
|
||||
|
||||
Reference in New Issue
Block a user