fix: "file can't be previewed" flashing (#993)

This commit is contained in:
Aman Harwara
2022-04-22 19:25:04 +05:30
committed by GitHub
parent 9b47f2e235
commit b594aae8b9

View File

@@ -21,12 +21,11 @@ type Props = {
export const FilePreviewModal: FunctionComponent<Props> = ({ application, file, onDismiss }) => {
const [objectUrl, setObjectUrl] = useState<string>()
const [isFilePreviewable, setIsFilePreviewable] = useState(false)
const [isLoadingFile, setIsLoadingFile] = useState(false)
const [isLoadingFile, setIsLoadingFile] = useState(true)
const [showFileInfoPanel, setShowFileInfoPanel] = useState(false)
const closeButtonRef = useRef<HTMLButtonElement>(null)
const getObjectUrl = useCallback(async () => {
setIsLoadingFile(true)
try {
const chunks: Uint8Array[] = []
await application.files.downloadFile(file, async (decryptedChunk: Uint8Array) => {