mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-13 01:55:53 +00:00
eslint: enable react-hooks checks
Also fix all errors, which can lead to subtile bugs. Mostly fixings deps and refactoring to make typescript happy.
This commit is contained in:
committed by
David Lechner
parent
ee466ac904
commit
9d71bb4734
@@ -187,12 +187,15 @@ const SelectHubPanel: React.VoidFunctionComponent<SelectHubPanelProps> = ({
|
||||
const i18n = useI18n();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const onDrop = useCallback((acceptedFiles: File[]) => {
|
||||
// should only be one file since multiple={false}
|
||||
acceptedFiles.forEach((f) => {
|
||||
onCustomFirmwareZip(f);
|
||||
});
|
||||
}, []);
|
||||
const onDrop = useCallback(
|
||||
(acceptedFiles: File[]) => {
|
||||
// should only be one file since multiple={false}
|
||||
acceptedFiles.forEach((f) => {
|
||||
onCustomFirmwareZip(f);
|
||||
});
|
||||
},
|
||||
[onCustomFirmwareZip],
|
||||
);
|
||||
|
||||
const onClick = useCallback(async () => {
|
||||
try {
|
||||
@@ -218,7 +221,7 @@ const SelectHubPanel: React.VoidFunctionComponent<SelectHubPanelProps> = ({
|
||||
);
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
}, [dispatch, onCustomFirmwareZip]);
|
||||
|
||||
const onKeyDown = useCallback(
|
||||
(e: React.KeyboardEvent) => {
|
||||
|
||||
@@ -202,7 +202,7 @@ export function useCustomFirmware(zipFile: File | undefined) {
|
||||
};
|
||||
|
||||
readFile();
|
||||
}, [zipFile, isMounted]);
|
||||
}, [zipFile, isMounted, reduxDispatch]);
|
||||
|
||||
const isCustomFirmwareRequested = useMemo(
|
||||
() => state.firmwareData !== undefined,
|
||||
|
||||
Reference in New Issue
Block a user