Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/hooks/useDocumentTitle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ function useDocumentTitle(title: string) {
useFocusEffect(
useCallback(() => {
setPageTitle(title);
return () => setPageTitle('');
}, [title]),
Comment on lines 7 to 9

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reset page title when focus effect is cleaned up

Dropping the cleanup here leaves currentPageTitle latched to the previous screen indefinitely, because updateUnread only falls back to CONFIG.SITE_TITLE when that value is empty. With NavigationContainer document titles disabled (src/libs/Navigation/NavigationRoot.tsx), any route that does not call useDocumentTitle (for example auth routes like SCREENS.VALIDATE_LOGIN in src/libs/Navigation/AppNavigator/AuthScreens.tsx) will inherit the last page title; a common case is leaving a report and then opening login/auth screens, where the tab can continue showing the old report name instead of the app title.

Useful? React with 👍 / 👎.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new screen should update it with its title. The way proposed above introduced a race condition that caused page titles to be reset more often than they were set to the correct ones.

);
}
Expand Down
Loading