Fix blank background when copiloting into an agent from the agent-DM RHP - #97869
Fix blank background when copiloting into an agent from the agent-DM RHP#97869MelvinBot wants to merge 2 commits into
Conversation
Co-authored-by: Michał Jasikowski <mjasikowski@users.noreply.github.com>
Co-authored-by: Michał Jasikowski <mjasikowski@users.noreply.github.com>
|
The two failing checks are review/process gates, not code failures — there's nothing to fix by pushing code.
Every actual code check is green (Bun tests, ESLint, Oxfmt, React Compiler, Storybook, unused styles, knip, all builds, So no code fix is warranted here — the PR just needs the author checklist completed and an independent review/approval. |
|
Re-checked — nothing has changed since my previous comment. The two remaining failing checks aren't code failures, so there's nothing to push:
All code checks are green (Bun tests, ESLint, Oxfmt, React Compiler, Storybook, typecheck, unused styles, knip, all builds, |
Explanation of Change
When an owner creates an agent on a wide/split layout, #95631 opens the owner↔agent DM in a dedicated unguarded RHP (
AGENT_REPORT) sitting over the guarded Agents settings pane. If the owner then taps Copilot into account from that RHP, the session email flips to the agent, soisAgentbecomestrueand the guardedAgentsPagecentral pane returnsnull— a blank background — until the RHP is closed.The redirect that should send the guarded pane to Profile lived only inside
useFocusEffect, which never fires here because the central pane is mounted but not focused (the RHP holds focus). Closing the RHP finally re-focused the pane and ran the effect, which is why "Profile appears" only after closing the RHP.This adds a focus-independent
useEffect(keyed on theisAgenttransition) that runs the same redirect when the guarded pane is mounted-but-unfocused, so the background is corrected immediately instead of rendering blank. The redirect logic is factored into a sharedredirectAgentAwaycallback reused by bothuseFocusEffectand the new effect; the new effect is skipped while focused sinceuseFocusEffectalready covers that case. Because the agent-DM RHP is the topmost modal, the existingdismissModal+ deferred-redirect path dismisses it and lands the user on Profile — matching the behavior of the already-guarded copilot path.Fixed Issues
$ #97843
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Verified on the fix branch (web, wide layout). After tapping Copilot into account from the agent-DM RHP, the background is fully rendered — no blank pane. Repeated twice with identical results.
Agents pane with the new agent-DM RHP open (Translator Tess), both agents listed behind
RHP Profile subview showing Copilot into account action, Agents pane visible behind (pre-tap)
Immediately after tapping Copilot into account - Inbox with agent DM fully rendered, no blank background
Agents list showing both agents after copiloting