Skip to content

Commit

Permalink
[Statsig] Send prev route name (#3456)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored Apr 9, 2024
1 parent c300d4c commit d89b6eb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,10 @@ function RoutesContainer({children}: React.PropsWithChildren<{}>) {
const theme = useColorSchemeStyle(DefaultTheme, DarkTheme)
const {currentAccount} = useSession()
const {openModal} = useModalControls()
const prevLoggedRouteName = React.useRef<string | undefined>(undefined)

function onReady() {
prevLoggedRouteName.current = getCurrentRouteName()
initAnalytics(currentAccount)

if (currentAccount && shouldRequestEmailConfirmation(currentAccount)) {
Expand All @@ -555,7 +557,10 @@ function RoutesContainer({children}: React.PropsWithChildren<{}>) {
linking={LINKING}
theme={theme}
onStateChange={() => {
logEvent('router:navigate', {})
logEvent('router:navigate', {
from: prevLoggedRouteName.current,
})
prevLoggedRouteName.current = getCurrentRouteName()
}}
onReady={() => {
attachRouteToLogEvents(getCurrentRouteName)
Expand Down

0 comments on commit d89b6eb

Please sign in to comment.