Skip to content

Commit 32ef5a2

Browse files
authored
fix: file viewer refreshes when interacting (#2276)
1 parent 6e6bf7e commit 32ef5a2

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/files/FilesPage.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ const FilesPage = ({
116116
}
117117

118118
const MainView = ({ t, files, remotePins, pendingPins, failedPins, doExploreUserProvidedPath }) => {
119-
if (!files) return (<div/>)
119+
if (!files || files.type === 'file') return (<div/>)
120120

121121
if (files.type === 'unknown') {
122122
const path = files.path
@@ -130,12 +130,6 @@ const FilesPage = ({
130130
)
131131
}
132132

133-
if (files.type === 'file') {
134-
return (
135-
<FilePreview {...files} onDownload={() => onDownload([files])} />
136-
)
137-
}
138-
139133
return (
140134
<FilesList
141135
key={window.encodeURIComponent(files.path)}
@@ -216,6 +210,8 @@ const FilesPage = ({
216210

217211
<MainView t={t} files={files} remotePins={remotePins} pendingPins={pendingPins} failedPins={failedPins} doExploreUserProvidedPath={doExploreUserProvidedPath}/>
218212

213+
<Preview files={files} onDownload={() => onDownload([files])} />
214+
219215
<InfoBoxes isRoot={filesPathInfo.isMfs && filesPathInfo.isRoot}
220216
isCompanion={false}
221217
filesExist={!!(files && files.content && files.content.length)} />
@@ -248,6 +244,13 @@ const FilesPage = ({
248244
)
249245
}
250246

247+
const Preview = ({ files, onDownload }) => {
248+
if (files && files.type === 'file') {
249+
return (<FilePreview {...files} onDownload={onDownload} />)
250+
}
251+
return (<div/>)
252+
}
253+
251254
export default connect(
252255
'selectIpfsProvider',
253256
'selectIpfsConnected',

0 commit comments

Comments
 (0)