Skip to content

Commit edc103d

Browse files
committed
fix(files): narrow fileData type for closure in docx/xlsx preview effects
1 parent 646f8d1 commit edc103d

File tree

1 file changed

+4
-2
lines changed
  • apps/sim/app/workspace/[workspaceId]/files/components/file-viewer

1 file changed

+4
-2
lines changed

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/file-viewer.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,14 +922,15 @@ const DocxPreview = memo(function DocxPreview({
922922

923923
useEffect(() => {
924924
if (!fileData) return
925+
const data = fileData
925926

926927
let cancelled = false
927928

928929
async function convert() {
929930
try {
930931
setRenderError(null)
931932
const mammoth = await import('mammoth')
932-
const result = await mammoth.convertToHtml({ arrayBuffer: fileData })
933+
const result = await mammoth.convertToHtml({ arrayBuffer: data })
933934
if (!cancelled) setHtml(result.value)
934935
} catch (err) {
935936
if (!cancelled) {
@@ -1004,14 +1005,15 @@ const XlsxPreview = memo(function XlsxPreview({
10041005

10051006
useEffect(() => {
10061007
if (!fileData) return
1008+
const data = fileData
10071009

10081010
let cancelled = false
10091011

10101012
async function parse() {
10111013
try {
10121014
setRenderError(null)
10131015
const XLSX = await import('xlsx')
1014-
const workbook = XLSX.read(fileData, { type: 'array' })
1016+
const workbook = XLSX.read(data, { type: 'array' })
10151017
if (!cancelled) {
10161018
workbookRef.current = workbook
10171019
setSheetNames(workbook.SheetNames)

0 commit comments

Comments
 (0)