mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-26 18:51:50 +02:00
Merge pull request #28630 from overleaf/dp-detached-pdf-errors
Add fileTreeData checks to FileTreePathProvider GitOrigin-RevId: 8c4701d9dc02ac30346d82f813f821c8561f98ed
This commit is contained in:
@@ -29,22 +29,34 @@ export const FileTreePathProvider: FC<React.PropsWithChildren> = ({
|
||||
const projectId = getMeta('ol-project_id')
|
||||
|
||||
const pathInFileTree = useCallback(
|
||||
(id: string) => pathInFolder(fileTreeData, id),
|
||||
(id: string) => {
|
||||
if (!fileTreeData) return null
|
||||
return pathInFolder(fileTreeData, id)
|
||||
},
|
||||
[fileTreeData]
|
||||
)
|
||||
|
||||
const findEntityByPathInFileTree = useCallback(
|
||||
(path: string) => findEntityByPath(fileTreeData, path),
|
||||
(path: string) => {
|
||||
if (!fileTreeData) return null
|
||||
return findEntityByPath(fileTreeData, path)
|
||||
},
|
||||
[fileTreeData]
|
||||
)
|
||||
|
||||
const previewByPathInFileTree = useCallback(
|
||||
(path: string) => previewByPath(fileTreeData, projectId, path),
|
||||
(path: string) => {
|
||||
if (!fileTreeData) return null
|
||||
return previewByPath(fileTreeData, projectId, path)
|
||||
},
|
||||
[fileTreeData, projectId]
|
||||
)
|
||||
|
||||
const dirnameInFileTree = useCallback(
|
||||
(id: string) => dirname(fileTreeData, id),
|
||||
(id: string) => {
|
||||
if (!fileTreeData) return null
|
||||
return dirname(fileTreeData, id)
|
||||
},
|
||||
[fileTreeData]
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user