Skip to content

The agent that grows with you

fix(desktop): measure rail after locale direction is applied

funky-xamarinfd2bf1c15de2
diff --git a/apps/desktop/src/app/chat/sidebar/profile-switcher.tsx b/apps/desktop/src/app/chat/sidebar/profile-switcher.tsx
index d4aa5d0d388..975ac63e203 100644
--- a/apps/desktop/src/app/chat/sidebar/profile-switcher.tsx
+++ b/apps/desktop/src/app/chat/sidebar/profile-switcher.tsx
@@ -327,8 +327,12 @@ export function ProfileRail() {
// Observe both widths: adding/removing a profile need not resize the viewport.
useResizeObserver(measureScroll, scrollRef, scrollContentRef)
- // A locale switch can reverse direction without changing either width.
- useEffect(measureScroll, [locale, measureScroll])
+ // The provider applies document direction in its effect; measure next frame.
+ useEffect(() => {
+ const frame = requestAnimationFrame(measureScroll)
+
+ return () => cancelAnimationFrame(frame)
+ }, [locale, measureScroll])
const switchToRest = (agent: FleetAgent) => {
const commitRestSwitch = (target: FleetAgent) => {