Skip to content

Commit

Permalink
Attempt to fix back button functionality for users coming from google
Browse files Browse the repository at this point in the history
  • Loading branch information
DinerIsmail committed Dec 3, 2023
1 parent cd870f5 commit 8614c24
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 7 additions & 3 deletions components/listing/Listing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ function Listing({ listing }) {
}, [])

const goBack = useCallback(() => {
void router.back()
// void router.push(`${PROTOCOL}://${subdomain}.${REMOTE_HOSTNAME}`)
}, [router])
const referrer = document.referrer
if (referrer.includes('google')) {
void router.push(`${PROTOCOL}://${subdomain}.${REMOTE_HOSTNAME}`)
} else {
void router.back()
}
}, [router, subdomain])

const { categories } = useCategories()
const categoriesIndexes = useMemo(() => {
Expand Down
6 changes: 2 additions & 4 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ import StoreProvider from '@store/StoreProvider'
if (typeof window !== 'undefined') {
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY, {
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST || 'https://app.posthog.com',
// Enable debug mode in development
loaded: (posthog) => {
if (process.env.NODE_ENV === 'development') posthog.debug()
},
debug: false,
})
posthog.debug(false)
}

const theme = extendTheme({
Expand Down

1 comment on commit 8614c24

@vercel
Copy link

@vercel vercel bot commented on 8614c24 Dec 3, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.