diff --git a/web/account/account-hooks.js b/web/account/account-hooks.js --- a/web/account/account-hooks.js +++ b/web/account/account-hooks.js @@ -4,7 +4,6 @@ import invariant from 'invariant'; import localforage from 'localforage'; import * as React from 'react'; -import { useDispatch } from 'react-redux'; import uuid from 'uuid'; import { @@ -22,6 +21,7 @@ NotificationsOlmDataType, } from 'lib/types/crypto-types.js'; import type { OlmSessionInitializationInfo } from 'lib/types/request-types.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import { generateCryptoKey, diff --git a/web/account/log-in-form.react.js b/web/account/log-in-form.react.js --- a/web/account/log-in-form.react.js +++ b/web/account/log-in-form.react.js @@ -2,10 +2,10 @@ import { useConnectModal } from '@rainbow-me/rainbowkit'; import * as React from 'react'; -import { useDispatch } from 'react-redux'; import { useWalletClient } from 'wagmi'; import { isDev } from 'lib/utils/dev-utils.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import { useGetOrCreateCryptoStore } from './account-hooks.js'; import css from './log-in-form.css'; diff --git a/web/account/siwe-login-form.react.js b/web/account/siwe-login-form.react.js --- a/web/account/siwe-login-form.react.js +++ b/web/account/siwe-login-form.react.js @@ -4,7 +4,6 @@ import classNames from 'classnames'; import invariant from 'invariant'; import * as React from 'react'; -import { useDispatch } from 'react-redux'; import { useAccount, useWalletClient } from 'wagmi'; import { setDataLoadedActionType } from 'lib/actions/client-db-store-actions.js'; @@ -25,6 +24,7 @@ useServerCall, } from 'lib/utils/action-utils.js'; import { ServerError } from 'lib/utils/errors.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import { createSIWEMessage, getSIWEStatementForPublicKey, diff --git a/web/app.react.js b/web/app.react.js --- a/web/app.react.js +++ b/web/app.react.js @@ -8,7 +8,6 @@ import * as React from 'react'; import { DndProvider } from 'react-dnd'; import { HTML5Backend } from 'react-dnd-html5-backend'; -import { useDispatch } from 'react-redux'; import { WagmiConfig } from 'wagmi'; import { @@ -30,6 +29,7 @@ import type { LoadingStatus } from 'lib/types/loading-types.js'; import type { Dispatch } from 'lib/types/redux-types.js'; import { registerConfig } from 'lib/utils/config.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import { infoFromURL } from 'lib/utils/url-utils.js'; import { AlchemyENSCacheProvider, wagmiConfig } from 'lib/utils/wagmi-utils.js'; diff --git a/web/calendar/day.react.js b/web/calendar/day.react.js --- a/web/calendar/day.react.js +++ b/web/calendar/day.react.js @@ -4,7 +4,6 @@ import invariant from 'invariant'; import _some from 'lodash/fp/some.js'; import * as React from 'react'; -import { useDispatch } from 'react-redux'; import { createLocalEntry, @@ -21,6 +20,7 @@ import type { Dispatch } from 'lib/types/redux-types.js'; import type { ThreadInfo } from 'lib/types/thread-types.js'; import { dateString, dateFromString } from 'lib/utils/date-utils.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import css from './calendar.css'; import type { InnerEntry } from './entry.react.js'; diff --git a/web/calendar/entry.react.js b/web/calendar/entry.react.js --- a/web/calendar/entry.react.js +++ b/web/calendar/entry.react.js @@ -3,7 +3,6 @@ import classNames from 'classnames'; import invariant from 'invariant'; import * as React from 'react'; -import { useDispatch } from 'react-redux'; import { createEntryActionTypes, @@ -47,6 +46,7 @@ import { dateString } from 'lib/utils/date-utils.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; import { ServerError } from 'lib/utils/errors.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; import css from './calendar.css'; diff --git a/web/calendar/filter-panel.react.js b/web/calendar/filter-panel.react.js --- a/web/calendar/filter-panel.react.js +++ b/web/calendar/filter-panel.react.js @@ -10,7 +10,6 @@ import classNames from 'classnames'; import * as React from 'react'; import { ChevronsLeft } from 'react-feather'; -import { useDispatch } from 'react-redux'; import Switch from 'react-switch'; import { @@ -30,6 +29,7 @@ setCalendarDeletedFilter, } from 'lib/types/filter-types.js'; import type { Dispatch } from 'lib/types/redux-types.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import css from './filter-panel.css'; import ThreadSettingsModal from '../modals/threads/settings/thread-settings-modal.react.js'; diff --git a/web/chat/chat-message-list-container.react.js b/web/chat/chat-message-list-container.react.js --- a/web/chat/chat-message-list-container.react.js +++ b/web/chat/chat-message-list-container.react.js @@ -5,9 +5,9 @@ import * as React from 'react'; import { useDrop } from 'react-dnd'; import { NativeTypes } from 'react-dnd-html5-backend'; -import { useDispatch } from 'react-redux'; import { useWatchThread, threadIsPending } from 'lib/shared/thread-utils.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import ChatInputBar from './chat-input-bar.react.js'; import css from './chat-message-list-container.css'; diff --git a/web/chat/chat-thread-composer.react.js b/web/chat/chat-thread-composer.react.js --- a/web/chat/chat-thread-composer.react.js +++ b/web/chat/chat-thread-composer.react.js @@ -4,7 +4,6 @@ import invariant from 'invariant'; import _isEqual from 'lodash/fp/isEqual.js'; import * as React from 'react'; -import { useDispatch } from 'react-redux'; import { useModalContext } from 'lib/components/modal-provider.react.js'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; @@ -23,6 +22,7 @@ } from 'lib/shared/thread-utils.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; import type { AccountUserInfo, UserListItem } from 'lib/types/user-types.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import css from './chat-thread-composer.css'; import UserAvatar from '../avatars/user-avatar.react.js'; diff --git a/web/chat/robotext-message.react.js b/web/chat/robotext-message.react.js --- a/web/chat/robotext-message.react.js +++ b/web/chat/robotext-message.react.js @@ -2,7 +2,6 @@ import invariant from 'invariant'; import * as React from 'react'; -import { useDispatch } from 'react-redux'; import { type RobotextChatMessageInfoItem } from 'lib/selectors/chat-selectors.js'; import { threadInfoSelector } from 'lib/selectors/thread-selectors.js'; @@ -13,6 +12,7 @@ entityTextToReact, useENSNamesForEntityText, } from 'lib/utils/entity-text.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import InlineEngagement from './inline-engagement.react.js'; import css from './robotext-message.css'; diff --git a/web/database/sqlite-data-handler.js b/web/database/sqlite-data-handler.js --- a/web/database/sqlite-data-handler.js +++ b/web/database/sqlite-data-handler.js @@ -1,7 +1,8 @@ // @flow import * as React from 'react'; -import { useDispatch } from 'react-redux'; + +import { useDispatch } from 'lib/utils/redux-utils.js'; import { getDatabaseModule } from './database-module-provider.js'; import { useSelector } from '../redux/redux-utils.js'; diff --git a/web/input/input-state-container.react.js b/web/input/input-state-container.react.js --- a/web/input/input-state-container.react.js +++ b/web/input/input-state-container.react.js @@ -8,7 +8,6 @@ import _sortBy from 'lodash/fp/sortBy.js'; import _memoize from 'lodash/memoize.js'; import * as React from 'react'; -import { useDispatch } from 'react-redux'; import { createSelector } from 'reselect'; import { @@ -95,6 +94,7 @@ } from 'lib/utils/blob-service.js'; import { getConfig } from 'lib/utils/config.js'; import { getMessageForException, cloneError } from 'lib/utils/errors.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import { generateReportID } from 'lib/utils/report-utils.js'; import { diff --git a/web/invite-links/invite-link-handler.react.js b/web/invite-links/invite-link-handler.react.js --- a/web/invite-links/invite-link-handler.react.js +++ b/web/invite-links/invite-link-handler.react.js @@ -1,7 +1,6 @@ // @flow import * as React from 'react'; -import { useDispatch } from 'react-redux'; import { verifyInviteLink, @@ -13,6 +12,7 @@ useDispatchActionPromise, useServerCall, } from 'lib/utils/action-utils.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import AcceptInviteModal from './accept-invite-modal.react.js'; import { updateNavInfoActionType } from '../redux/action-types.js'; diff --git a/web/modals/apps/app-listing.react.js b/web/modals/apps/app-listing.react.js --- a/web/modals/apps/app-listing.react.js +++ b/web/modals/apps/app-listing.react.js @@ -5,7 +5,6 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import classnames from 'classnames'; import * as React from 'react'; -import { useDispatch } from 'react-redux'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; import { @@ -13,6 +12,7 @@ enableAppActionType, } from 'lib/reducers/enabled-apps-reducer.js'; import type { SupportedApps } from 'lib/types/enabled-apps.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import css from './apps.css'; import Button from '../../components/button.react.js'; diff --git a/web/modals/threads/create/compose-subchannel-modal.react.js b/web/modals/threads/create/compose-subchannel-modal.react.js --- a/web/modals/threads/create/compose-subchannel-modal.react.js +++ b/web/modals/threads/create/compose-subchannel-modal.react.js @@ -1,6 +1,6 @@ // @flow + import * as React from 'react'; -import { useDispatch, useSelector } from 'react-redux'; import { useNewThread, @@ -12,6 +12,7 @@ import type { ThreadInfo } from 'lib/types/thread-types.js'; import { useDispatchActionPromise } from 'lib/utils/action-utils.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import { trimText } from 'lib/utils/text-utils.js'; import css from './compose-subchannel-modal.css'; @@ -20,6 +21,7 @@ import type { VisibilityType } from './steps/subchannel-settings.react.js'; import Stepper from '../../../components/stepper.react.js'; import { updateNavInfoActionType } from '../../../redux/action-types.js'; +import { useSelector } from '../../../redux/redux-utils.js'; import { nonThreadCalendarQuery } from '../../../selectors/nav-selectors.js'; import Modal from '../../modal.react.js'; diff --git a/web/modals/threads/create/steps/subchannel-members.react.js b/web/modals/threads/create/steps/subchannel-members.react.js --- a/web/modals/threads/create/steps/subchannel-members.react.js +++ b/web/modals/threads/create/steps/subchannel-members.react.js @@ -1,7 +1,6 @@ // @flow import * as React from 'react'; -import { useSelector } from 'react-redux'; import { userStoreSearchIndex } from 'lib/selectors/user-selectors.js'; import { useAncestorThreads } from 'lib/shared/ancestor-threads.js'; @@ -11,6 +10,7 @@ import MembersList from './subchannel-members-list.react.js'; import css from './subchannel-members.css'; import Search from '../../../../components/search.react.js'; +import { useSelector } from '../../../../redux/redux-utils.js'; type SubchannelMembersProps = { +parentThreadInfo: ThreadInfo | MinimallyEncodedThreadInfo, diff --git a/web/navigation-panels/app-switcher.react.js b/web/navigation-panels/app-switcher.react.js --- a/web/navigation-panels/app-switcher.react.js +++ b/web/navigation-panels/app-switcher.react.js @@ -1,10 +1,10 @@ // @flow import * as React from 'react'; -import { useDispatch } from 'react-redux'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; import { mostRecentlyReadThreadSelector } from 'lib/selectors/thread-selectors.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import NavigationPanel from './navigation-panel.react.js'; import css from './topbar.css'; diff --git a/web/navigation-panels/settings-switcher.react.js b/web/navigation-panels/settings-switcher.react.js --- a/web/navigation-panels/settings-switcher.react.js +++ b/web/navigation-panels/settings-switcher.react.js @@ -1,7 +1,8 @@ // @flow import * as React from 'react'; -import { useDispatch } from 'react-redux'; + +import { useDispatch } from 'lib/utils/redux-utils.js'; import NavigationPanel from './navigation-panel.react.js'; import css from './settings-switcher.css'; diff --git a/web/push-notif/push-notifs-handler.js b/web/push-notif/push-notifs-handler.js --- a/web/push-notif/push-notifs-handler.js +++ b/web/push-notif/push-notifs-handler.js @@ -1,7 +1,6 @@ // @flow import * as React from 'react'; -import { useDispatch } from 'react-redux'; import { useSetDeviceTokenFanout, @@ -15,6 +14,7 @@ shouldSkipPushPermissionAlert, recordNotifPermissionAlertActionType, } from 'lib/utils/push-alerts.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; import { diff --git a/web/redux/focus-handler.react.js b/web/redux/focus-handler.react.js --- a/web/redux/focus-handler.react.js +++ b/web/redux/focus-handler.react.js @@ -1,7 +1,8 @@ // @flow import * as React from 'react'; -import { useDispatch } from 'react-redux'; + +import { useDispatch } from 'lib/utils/redux-utils.js'; import { updateWindowActiveActionType } from './action-types.js'; import { useSelector } from './redux-utils.js'; diff --git a/web/redux/initial-state-gate.js b/web/redux/initial-state-gate.js --- a/web/redux/initial-state-gate.js +++ b/web/redux/initial-state-gate.js @@ -1,7 +1,6 @@ // @flow import * as React from 'react'; -import { useDispatch } from 'react-redux'; import { PersistGate } from 'redux-persist/es/integration/react.js'; import type { Persistor } from 'redux-persist/es/types'; @@ -11,6 +10,7 @@ import type { RawThreadInfo } from 'lib/types/thread-types.js'; import { convertIDToNewSchema } from 'lib/utils/migration-utils.js'; import { entries } from 'lib/utils/objects.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import { infoFromURL } from 'lib/utils/url-utils.js'; import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; diff --git a/web/redux/visibility-handler.react.js b/web/redux/visibility-handler.react.js --- a/web/redux/visibility-handler.react.js +++ b/web/redux/visibility-handler.react.js @@ -1,10 +1,10 @@ // @flow import * as React from 'react'; -import { useDispatch } from 'react-redux'; import { updateLifecycleStateActionType } from 'lib/reducers/lifecycle-state-reducer.js'; import { useIsAppForegrounded } from 'lib/shared/lifecycle-utils.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import { useVisibility } from './visibility.js'; diff --git a/web/selectors/thread-selectors.js b/web/selectors/thread-selectors.js --- a/web/selectors/thread-selectors.js +++ b/web/selectors/thread-selectors.js @@ -2,7 +2,6 @@ import invariant from 'invariant'; import * as React from 'react'; -import { useDispatch } from 'react-redux'; import { createSelector } from 'reselect'; import { ENSCacheContext } from 'lib/components/ens-cache-provider.react.js'; @@ -19,6 +18,7 @@ import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ThreadInfo, RawThreadInfos } from 'lib/types/thread-types.js'; import { values } from 'lib/utils/objects.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import { getDefaultTextMessageRules } from '../markdown/rules.react.js'; import { updateNavInfoActionType } from '../redux/action-types.js'; diff --git a/web/sidebar/community-creation/community-creation-modal.react.js b/web/sidebar/community-creation/community-creation-modal.react.js --- a/web/sidebar/community-creation/community-creation-modal.react.js +++ b/web/sidebar/community-creation/community-creation-modal.react.js @@ -1,7 +1,6 @@ // @flow import * as React from 'react'; -import { useDispatch } from 'react-redux'; import { useNewThread, @@ -13,6 +12,7 @@ import { threadTypes } from 'lib/types/thread-types-enum.js'; import type { NewThreadResult } from 'lib/types/thread-types.js'; import { useDispatchActionPromise } from 'lib/utils/action-utils.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import CommunityCreationKeyserverLabel from './community-creation-keyserver-label.react.js'; import CommunityCreationMembersModal from './community-creation-members-modal.react.js'; diff --git a/web/sidebar/community-drawer-item-community-handlers.react.js b/web/sidebar/community-drawer-item-community-handlers.react.js --- a/web/sidebar/community-drawer-item-community-handlers.react.js +++ b/web/sidebar/community-drawer-item-community-handlers.react.js @@ -1,7 +1,6 @@ // @flow import * as React from 'react'; -import { useDispatch } from 'react-redux'; import { updateCalendarCommunityFilter, @@ -10,6 +9,7 @@ } from 'lib/actions/community-actions.js'; import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ThreadInfo } from 'lib/types/thread-types.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import type { CommunityDrawerItemCommunityHandler } from './community-drawer-item-handler.react.js'; import { useSelector } from '../redux/redux-utils.js'; diff --git a/web/sidebar/community-picker.react.js b/web/sidebar/community-picker.react.js --- a/web/sidebar/community-picker.react.js +++ b/web/sidebar/community-picker.react.js @@ -2,7 +2,6 @@ import classNames from 'classnames'; import * as React from 'react'; -import { useDispatch } from 'react-redux'; import { clearCalendarCommunityFilter, @@ -11,6 +10,7 @@ import { useModalContext } from 'lib/components/modal-provider.react.js'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; import { unreadCount } from 'lib/selectors/thread-selectors.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import CommunityCreationModal from './community-creation/community-creation-modal.react.js'; import CommunityDrawer from './community-drawer.react.js'; diff --git a/web/socket.react.js b/web/socket.react.js --- a/web/socket.react.js +++ b/web/socket.react.js @@ -2,7 +2,6 @@ import invariant from 'invariant'; import * as React from 'react'; -import { useDispatch } from 'react-redux'; import { useLogOut } from 'lib/actions/user-actions.js'; import { preRequestUserStateForSingleKeyserverSelector } from 'lib/selectors/account-selectors.js'; @@ -15,6 +14,7 @@ import { useInitialNotificationsEncryptedMessage } from 'lib/shared/crypto-utils.js'; import Socket, { type BaseSocketProps } from 'lib/socket/socket.react.js'; import { useDispatchActionPromise } from 'lib/utils/action-utils.js'; +import { useDispatch } from 'lib/utils/redux-utils.js'; import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; import {