diff --git a/src/modules/views/Drive/FilesViewerDrive.jsx b/src/modules/views/Drive/FilesViewerDrive.jsx index 644bb10fb0..ba4f23a47f 100644 --- a/src/modules/views/Drive/FilesViewerDrive.jsx +++ b/src/modules/views/Drive/FilesViewerDrive.jsx @@ -4,9 +4,10 @@ import { useNavigate } from 'react-router-dom' import { useQuery } from 'cozy-client' +import { FilesViewerLoading } from 'components/FilesViewerLoading' import { useFolderSort } from 'modules/navigation/duck' import { getFolderPath } from 'modules/routeUtils' -import FilesViewer, { FilesViewerLoading } from 'modules/viewer/FilesViewer' +import FilesViewer from 'modules/viewer/FilesViewer' import { buildDriveQuery } from 'queries' const FilesViewerDrive = () => { @@ -20,13 +21,15 @@ const FilesViewerDrive = () => { sortAttribute: sortOrder.attribute, sortOrder: sortOrder.order }) + const filesQuery = useQuery( buildedFilesQuery.definition, buildedFilesQuery.options ) - if (filesQuery.data) { - const viewableFiles = filesQuery.data + const viewableFiles = filesQuery.data + + if (viewableFiles) { return ( { } /> ) - } else { - return } + + return } export default FilesViewerDrive diff --git a/src/modules/views/Recent/FilesViewerRecent.jsx b/src/modules/views/Recent/FilesViewerRecent.jsx index dd6823e7df..d76c5acf33 100644 --- a/src/modules/views/Recent/FilesViewerRecent.jsx +++ b/src/modules/views/Recent/FilesViewerRecent.jsx @@ -3,7 +3,8 @@ import { useNavigate } from 'react-router-dom' import { useQuery } from 'cozy-client' -import FilesViewer, { FilesViewerLoading } from 'modules/viewer/FilesViewer' +import { FilesViewerLoading } from 'components/FilesViewerLoading' +import FilesViewer from 'modules/viewer/FilesViewer' import { buildRecentQuery } from 'queries' const FilesViewerRecent = () => { diff --git a/src/modules/views/Sharings/FilesViewerSharings.jsx b/src/modules/views/Sharings/FilesViewerSharings.jsx index f05f7b871e..0dcb0cd2e3 100644 --- a/src/modules/views/Sharings/FilesViewerSharings.jsx +++ b/src/modules/views/Sharings/FilesViewerSharings.jsx @@ -5,7 +5,8 @@ import { useNavigate } from 'react-router-dom' import { useQuery } from 'cozy-client' import withSharedDocumentIds from './withSharedDocumentIds' -import FilesViewer, { FilesViewerLoading } from 'modules/viewer/FilesViewer' +import { FilesViewerLoading } from 'components/FilesViewerLoading' +import FilesViewer from 'modules/viewer/FilesViewer' import { buildSharingsQuery } from 'queries' const FilesViewerSharing = ({ sharedDocumentIds }) => { diff --git a/src/modules/views/Trash/FilesViewerTrash.jsx b/src/modules/views/Trash/FilesViewerTrash.jsx index 580513b8ca..b85dd886f1 100644 --- a/src/modules/views/Trash/FilesViewerTrash.jsx +++ b/src/modules/views/Trash/FilesViewerTrash.jsx @@ -4,8 +4,9 @@ import { useNavigate } from 'react-router-dom' import { useQuery } from 'cozy-client' +import { FilesViewerLoading } from 'components/FilesViewerLoading' import { useFolderSort } from 'modules/navigation/duck' -import FilesViewer, { FilesViewerLoading } from 'modules/viewer/FilesViewer' +import FilesViewer from 'modules/viewer/FilesViewer' import { buildTrashQuery } from 'queries' const FilesViewerTrash = () => {