Skip to content

Commit

Permalink
solve 694
Browse files Browse the repository at this point in the history
  • Loading branch information
barbalex committed Dec 12, 2024
1 parent bd36158 commit 98d3d0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/components/shared/Files/Menu/ListMenus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ import { useCallback, useContext, memo } from 'react'
import IconButton from '@mui/material/IconButton'
import Tooltip from '@mui/material/Tooltip'
import { FaPlus, FaEye } from 'react-icons/fa6'
import { useNavigate } from 'react-router'
import { useNavigate, useLocation } from 'react-router'

import { ErrorBoundary } from '../../ErrorBoundary.jsx'
import { UploaderContext } from '../../../../UploaderContext.js'

export const ListMenus = memo(({ files }) => {
const navigate = useNavigate()
const { search } = useLocation()
const uploaderCtx = useContext(UploaderContext)
const api = uploaderCtx?.current?.getAPI?.()

const firstFileId = files?.[0]?.fileId

const onClickPreview = useCallback(() => {
navigate(`${firstFileId}/Vorschau`)
navigate(`${firstFileId}/Vorschau${search}`)
}, [firstFileId])

return (
Expand Down
4 changes: 2 additions & 2 deletions src/components/shared/Files/Menu/PreviewMenus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const PreviewMenus = memo(
const store = useContext(StoreContext)
const { fileId } = useParams()
const navigate = useNavigate()
const { pathname } = useLocation()
const { pathname, search } = useLocation()
const client = useApolloClient()
const uploaderCtx = useContext(UploaderContext)
const api = uploaderCtx?.current?.getAPI?.()
Expand All @@ -41,7 +41,7 @@ export const PreviewMenus = memo(
// relative navigation using ../.. does not work here
const fileIdBeginsAt = pathname.indexOf(fileId)
const newPathname = pathname.slice(0, fileIdBeginsAt)
navigate(newPathname)
navigate(`${newPathname}${search}`)
}, [pathname, fileId])

const [delMenuAnchorEl, setDelMenuAnchorEl] = useState(null)
Expand Down

0 comments on commit 98d3d0d

Please sign in to comment.