Skip to content

Commit 6b81b33

Browse files
committed
Fix ESLint react-hooks/set-state-in-effect error in App.tsx
1 parent a57f8ea commit 6b81b33

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/ui/App.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,19 @@ export default function App() {
5151
}, []);
5252

5353
useEffect(() => {
54-
const pendingFile = consumePendingFile();
55-
if (pendingFile) {
56-
handleFile(pendingFile);
54+
const pendingFile = consumePendingFile();
55+
if (pendingFile) {
56+
const ext = pendingFile.name.split(".").pop()?.trim().toLowerCase() ?? "";
57+
if (!isSupportedExt(ext)) {
58+
setError(
59+
"Unsupported file type. Use STEP/STP/IGES/IGS/BREP, STL/OBJ/3MF/GLTF/GLB, or DXF.",
60+
);
61+
return;
5762
}
58-
}, [handleFile]);
63+
setError(null);
64+
setFile(pendingFile);
65+
}
66+
}, [handleFile]);
5967

6068
function onFileChange(event: React.ChangeEvent<HTMLInputElement>): void {
6169
const next = event.target.files?.[0] ?? null;

0 commit comments

Comments
 (0)