Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review: skip menu pos state update when unchanged

Adam Eivy11427b8c19e7
diff --git a/client/src/components/dashboard/LayoutPicker.jsx b/client/src/components/dashboard/LayoutPicker.jsx
index fa004f1be1..e993a5f50e 100644
--- a/client/src/components/dashboard/LayoutPicker.jsx
+++ b/client/src/components/dashboard/LayoutPicker.jsx
@@ -37,16 +37,18 @@ export default function LayoutPicker({ layouts, activeLayoutId, onSelect, onEdit
// If aligning the dropdown's right edge with the button's right edge
// would clip the left side, anchor it to the viewport's right edge
// instead via fixed positioning.
- if (rect.right - desiredWidth < padding) {
- setMenuPos({
- position: 'fixed',
- top: rect.bottom + 4,
- right: padding,
- left: 'auto',
- });
- } else {
- setMenuPos(null);
- }
+ const next = rect.right - desiredWidth < padding
+ ? { position: 'fixed', top: rect.bottom + 4, right: padding, left: 'auto' }
+ : null;
+ // Same-reference updater short-circuits when nothing changed so the
+ // capture-phase scroll listener doesn't trigger a re-render every
+ // pixel — important on mobile where this fires at touch-scroll rate.
+ setMenuPos((prev) => {
+ if (prev === next) return prev;
+ if (!prev || !next) return next;
+ if (prev.top === next.top && prev.right === next.right) return prev;
+ return next;
+ });
};
compute();
window.addEventListener('resize', compute);