Skip to content

Commit

Permalink
fix: View freeze while using swipe gesture to go back in safari (#2412)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangzy1 authored Jan 2, 2025
1 parent 020abfd commit 9ee3d3d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/renderer/src/modules/entry-content/index.mobile.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ScrollElementContext } from "@follow/components/ui/scroll-area/ctx.js"
import { useTitle } from "@follow/hooks"
import type { FeedModel, InboxModel, SupportedLanguages } from "@follow/models/types"
import { stopPropagation } from "@follow/utils/dom"
import { nextFrame, stopPropagation } from "@follow/utils/dom"
import { cn } from "@follow/utils/utils"
import { ErrorBoundary } from "@sentry/react"
import { useEffect, useMemo, useState } from "react"
Expand Down Expand Up @@ -47,8 +47,10 @@ export const EntryContent: Component<{
useEffect(() => {
const handlePopState = (event: PopStateEvent) => {
event.preventDefault()
// This is triggered when the back button is pressed
navigateEntry({ entryId: null, ...params })
nextFrame(() => {
// This is triggered when the back button is pressed
navigateEntry({ entryId: null, ...params })
})
}

// Listen to the popstate event (back button)
Expand Down

0 comments on commit 9ee3d3d

Please sign in to comment.