firmware/installPybricksDialog: fix use of useCustomFirmware()

useCustomFirmware() was called multiple times with the same file which
resulted in the same file being parsed 3 times. Instead we should only
call useCustomFirmware() and pass the results as props instead.
This commit is contained in:
David Lechner
2023-02-16 14:10:07 -06:00
committed by David Lechner
parent 1e295f8dbf
commit c8bcddbffd
2 changed files with 20 additions and 15 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2022 The Pybricks Authors
// Copyright (c) 2022-2023 The Pybricks Authors
// based on https://usehooks-ts.com/react-hook/use-fetch
import { FirmwareMetadata, FirmwareReader } from '@pybricks/firmware';
@@ -15,7 +15,7 @@ import { alertsShowAlert } from '../../alerts/actions';
import { Hub } from '../../components/hubPicker';
import { ensureError } from '../../utils';
type FirmwareData = {
export type FirmwareData = {
firmwareZip: ArrayBuffer;
licenseText: string;
metadata: FirmwareMetadata;