actions: drop typed dispatch

This doesn't provide much benefit and is just one more rule to remember,
so we can do without it.
This commit is contained in:
David Lechner
2022-02-24 17:16:52 -06:00
parent e4b7a9aec7
commit cf8744a6cd
12 changed files with 11 additions and 23 deletions
-12
View File
@@ -1,8 +1,6 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2020-2022 The Pybricks Authors
import { useDispatch as useReduxDispatch } from 'react-redux';
import { Dispatch as ReduxDispatch } from 'redux';
import { AppAction } from './app/actions';
import { BleDIServiceAction } from './ble-device-info-service/actions';
import { BleUartAction } from './ble-nordic-uart-service/actions';
@@ -58,13 +56,3 @@ export type Action =
| ServiceWorkerAction
| SettingsAction
| TerminalDataAction;
/**
* Dispatch function.
*/
export type Dispatch = ReduxDispatch<Action>;
/**
* Typed version of Redux useDispatch() hook.
*/
export const useDispatch = (): Dispatch => useReduxDispatch<Dispatch>();
+1 -1
View File
@@ -3,8 +3,8 @@
import { Classes } from '@blueprintjs/core';
import React, { useEffect, useState } from 'react';
import { useDispatch } from 'react-redux';
import SplitterLayout from 'react-splitter-layout';
import { useDispatch } from '../actions';
import Editor from '../editor/Editor';
import { useSelector } from '../reducers';
import { toggleBoolean } from '../settings/actions';
+1 -1
View File
@@ -12,8 +12,8 @@ import tomorrowNightEightiesTheme from 'monaco-themes/themes/Tomorrow-Night-Eigh
import xcodeTheme from 'monaco-themes/themes/Xcode_default.json';
import React, { useRef } from 'react';
import MonacoEditor, { monaco } from 'react-monaco-editor';
import { useDispatch } from 'react-redux';
import { IDisposable } from 'xterm';
import { useDispatch } from '../actions';
import { fileStorageWriteFile } from '../fileStorage/actions';
import { compile } from '../mpy/actions';
import { useSelector } from '../reducers';
+1 -1
View File
@@ -2,7 +2,7 @@
// Copyright (c) 2020-2021 The Pybricks Authors
import React from 'react';
import { useDispatch } from '../actions';
import { useDispatch } from 'react-redux';
import * as notificationActions from '../notifications/actions';
import { useSelector } from '../reducers';
import OpenFileButton, { OpenFileButtonProps } from '../toolbar/OpenFileButton';
+1 -1
View File
@@ -2,7 +2,7 @@
// Copyright (c) 2020-2021 The Pybricks Authors
import React from 'react';
import { useDispatch } from '../actions';
import { useDispatch } from 'react-redux';
import * as editorActions from '../editor/actions';
import { useSelector } from '../reducers';
import ActionButton, { ActionButtonProps } from '../toolbar/ActionButton';
+1 -1
View File
@@ -2,7 +2,7 @@
// Copyright (c) 2020-2021 The Pybricks Authors
import React from 'react';
import { useDispatch } from '../actions';
import { useDispatch } from 'react-redux';
import { BleConnectionState } from '../ble/reducers';
import { BootloaderConnectionState } from '../lwp3-bootloader/reducers';
import * as notificationActions from '../notifications/actions';
+1 -1
View File
@@ -2,7 +2,7 @@
// Copyright (c) 2020-2021 The Pybricks Authors
import React from 'react';
import { useDispatch } from '../actions';
import { useDispatch } from 'react-redux';
import { toggleBluetooth } from '../ble/actions';
import { BleConnectionState } from '../ble/reducers';
import { BootloaderConnectionState } from '../lwp3-bootloader/reducers';
+1 -1
View File
@@ -2,7 +2,7 @@
// Copyright (c) 2020-2021 The Pybricks Authors
import React from 'react';
import { useDispatch } from '../actions';
import { useDispatch } from 'react-redux';
import { useSelector } from '../reducers';
import ActionButton, { ActionButtonProps } from '../toolbar/ActionButton';
import { TooltipId } from '../toolbar/i18n';
+1 -1
View File
@@ -2,7 +2,7 @@
// Copyright (c) 2020-2021 The Pybricks Authors
import React from 'react';
import { useDispatch } from '../actions';
import { useDispatch } from 'react-redux';
import { useSelector } from '../reducers';
import ActionButton, { ActionButtonProps } from '../toolbar/ActionButton';
import { TooltipId } from '../toolbar/i18n';
+1 -1
View File
@@ -14,7 +14,7 @@ import {
} from '@blueprintjs/core';
import { useI18n } from '@shopify/react-i18n';
import React from 'react';
import { useDispatch } from '../actions';
import { useDispatch } from 'react-redux';
import { appName } from '../app/constants';
import { useSelector } from '../reducers';
import { fetchList, select } from './actions';
+1 -1
View File
@@ -19,8 +19,8 @@ import {
import { Tooltip2 } from '@blueprintjs/popover2';
import { useI18n } from '@shopify/react-i18n';
import React, { useMemo, useState } from 'react';
import { useDispatch } from 'react-redux';
import AboutDialog from '../about/AboutDialog';
import { useDispatch } from '../actions';
import { checkForUpdate, installPrompt, reload } from '../app/actions';
import {
pybricksBugReportsUrl,
+1 -1
View File
@@ -5,9 +5,9 @@ import { Menu, MenuDivider, MenuItem, ResizeSensor } from '@blueprintjs/core';
import { ContextMenu2, ContextMenu2ContentProps } from '@blueprintjs/popover2';
import { useI18n } from '@shopify/react-i18n';
import React, { useContext, useEffect, useMemo, useRef } from 'react';
import { useDispatch } from 'react-redux';
import { Terminal as XTerm } from 'xterm';
import { FitAddon } from 'xterm-addon-fit';
import { useDispatch } from '../actions';
import { useSelector } from '../reducers';
import { isMacOS } from '../utils/os';
import { TerminalContext } from './TerminalContext';