You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Exploratory] - Workspaces - Scroll position not preserved if returning to WS list after navigating to inbox #91503
Version Number: 9.3.80-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#90970 Email or phone of affected tester (no customers):ibellicotest+2250@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Windows 11 / Chrome App Component: Workspace Settings
Action Performed:
Prerequisite: Account has at least 5 workspaces and workspaces list is scrollable.
Open the staging.new.expensify.com
Navigate to "Workspaces"
Scroll to the bottom of workspaces list and open the last workspace.
Click on the back button on the top left corner to return to workspaces list.
Note that scroll position was preserved.
Reopen last workspace.
Click on "Inbox" and return to "Workspaces"
From workspace menu, click on back button again to return to workspaces list.
Note that scroll position wasn´t preserved.
Expected Result:
Everytime the user returns from workspace menu to workspaces list, scroll position should be preserved.
Actual Result:
Scroll position is not preserved when returning from workspace overview to workspaces list if user navigated to "Inbox" previously.
When the user navigates from the Workspaces list page to the Inbox tab, the WorkspacesListPage screen is unmounted from the navigation stack. Consequently, all local component-level states and references (such as a local useRef storing the scroll offset) are destroyed. When returning to the workspaces list, a brand new instance of WorkspacesListPage is mounted, resetting the local scroll offset reference to 0 and causing the scroll position to be lost.
What changes do you think we should make in order to solve the problem?
We should persistently save and restore the scroll position using the global ScrollOffsetContext, which is defined at the root level of the application (under ScrollOffsetContextProvider) and designed exactly to preserve list offsets across unmount/mount lifecycles.
Specifically, in src/pages/workspace/WorkspacesListPage.tsx:
Import ScrollOffsetContext from @components/ScrollOffsetContextProvider.
Access saveScrollOffset and getScrollOffset from the context using the useContext hook.
In the useEffect hook that handles refocus/mount (triggered by isFocused and useRoute), retrieve the saved scroll offset via getScrollOffset(route) and call flatlistRef.current?.scrollToOffset({ offset: scrollOffset, animated: false }) using a requestAnimationFrame callback.
Update the onScroll prop of the FlatList component to save the current scroll offset using saveScrollOffset(route, event.nativeEvent.contentOffset.y), ignoring events where event.nativeEvent.layoutMeasurement.height === 0.
What alternative solutions did you explore? (Optional)
An alternative solution is using Onyx keys to store the scroll position, but using the built-in ScrollOffsetContext is the standard pattern in the codebase (e.g., used by InitialSettingsPage, LHNOptionsList, and search screens) and does not introduce Onyx read/write latency.
This issue has not been updated in over 15 days. eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
Activity
applause-bot commentedon May 23, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/525dc61021b9679a760971e1cdb70c610eab0134d08c642634a29b7c44611920
harryautomazione commentedon May 23, 2026
Proposal
What is the root cause of that problem?
When the user navigates from the
Workspaceslist page to theInboxtab, theWorkspacesListPagescreen is unmounted from the navigation stack. Consequently, all local component-level states and references (such as a localuseRefstoring the scroll offset) are destroyed. When returning to the workspaces list, a brand new instance ofWorkspacesListPageis mounted, resetting the local scroll offset reference to0and causing the scroll position to be lost.What changes do you think we should make in order to solve the problem?
We should persistently save and restore the scroll position using the global
ScrollOffsetContext, which is defined at the root level of the application (underScrollOffsetContextProvider) and designed exactly to preserve list offsets across unmount/mount lifecycles.Specifically, in
src/pages/workspace/WorkspacesListPage.tsx:ScrollOffsetContextfrom@components/ScrollOffsetContextProvider.saveScrollOffsetandgetScrollOffsetfrom the context using theuseContexthook.useEffecthook that handles refocus/mount (triggered byisFocusedanduseRoute), retrieve the saved scroll offset viagetScrollOffset(route)and callflatlistRef.current?.scrollToOffset({ offset: scrollOffset, animated: false })using arequestAnimationFramecallback.onScrollprop of theFlatListcomponent to save the current scroll offset usingsaveScrollOffset(route, event.nativeEvent.contentOffset.y), ignoring events whereevent.nativeEvent.layoutMeasurement.height === 0.What alternative solutions did you explore? (Optional)
An alternative solution is using Onyx keys to store the scroll position, but using the built-in
ScrollOffsetContextis the standard pattern in the codebase (e.g., used byInitialSettingsPage,LHNOptionsList, and search screens) and does not introduce Onyx read/write latency.melvin-bot commentedon May 26, 2026
Whoops! This issue is 2 days overdue. Let's get this updated quick!
melvin-bot commentedon May 28, 2026
Huh... This is 4 days overdue. Who can take care of this?
melvin-bot commentedon Jun 1, 2026
8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!
melvin-bot commentedon Jun 3, 2026
10 days overdue. I'm getting more depressed than Marvin.
melvin-bot commentedon Jun 5, 2026
12 days overdue. Walking. Toward. The. Light...
melvin-bot commentedon Jun 8, 2026
This issue has not been updated in over 14 days. eroding to Weekly issue.
melvin-bot commentedon Jul 2, 2026
This issue has not been updated in over 15 days. eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
melvin-bot commentedon Sep 14, 2026
@applause-bot[bot], this Monthly task hasn't been acted upon in 6 weeks; closing.
If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead.