Skip to content

Commit

Permalink
[PAY-3523] Fix bug where share to DM persists in input (#10070)
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondjacobson authored Oct 16, 2024
1 parent 490a050 commit 8aa7242
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/web/src/pages/chat-page/ChatPageProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { useEffect } from 'react'

import { RouteComponentProps } from 'react-router-dom'

import { useHistoryContext } from 'app/HistoryProvider'
import { useIsMobile } from 'hooks/useIsMobile'
import { useManagedAccountNotAllowedRedirect } from 'hooks/useManagedAccountNotAllowedRedirect'

Expand All @@ -18,6 +21,14 @@ export const ChatPageProvider = ({
const currentChatId = match.params.id
const presetMessage = location.state?.presetMessage
const isMobile = useIsMobile()
const { history } = useHistoryContext()

// Replace the preset message in browser history after the first navigation
useEffect(() => {
if (presetMessage) {
history.replace({ state: { presetMessage: undefined } })
}
}, [history, presetMessage])

if (isMobile) {
return <MobileChatPage />
Expand Down

0 comments on commit 8aa7242

Please sign in to comment.