Improve Redux types part 5/Replace DispatchFunc (#26004)
* Remove non-functional code from Login component * Remove remaining usage of useDispatch<DispatchFunc> * Remove usage of DispatchFunc from actions/file_actions * actions/global_actions * Remove usage of DispatchFunc from actions/marketplace * Remove DispatchFunc from actions/post_actions * Remove DispatchFunc from actions/storage * Remove DispatchFunc from actions/user_actions * Remove DispatchFunc from actions/views/channel * Remove DispatchFunc from actions/views/channel_sidebar * Remove DispatchFunc from actions/views/create_comment * Remove DispatchFunc from actions/views/lhs.ts * Remove DispatchFunc from actions/views/rhs.ts * Remove DispatchFunc from actions/views/onboarding_tasks * Remove DispatchFunc from actions/views/root * Remove DispatchFunc from components/logged_in * Remove DispatchFunc from components/msg_typing * Remove DispatchFunc from components/permalink_view * Remove DispatchFunc from components/suggestion * Remove DispatchFunc from mattermost-redux/actions/posts * Remove DispatchFunc from mattermost-redux/actions/roles * Remove DispatchFunc from mattermost-redux/actions/threads * Remove DispatchFunc from mattermost-redux/actions/timezone * Remove DispatchFunc from plugins/products * Make DispatchFunc into Dispatch * Fix how dispatch is mocked in test for toggleSideBarRightMenuAction
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d8e11fe292
Коммит
8e165c7685
@@ -3,7 +3,7 @@
|
||||
|
||||
import type {Store} from 'redux';
|
||||
|
||||
import type {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
|
||||
import type {NewActionFuncAsync, ThunkActionFunc} from 'mattermost-redux/types/actions';
|
||||
|
||||
import store from 'stores/redux_store';
|
||||
|
||||
@@ -14,8 +14,8 @@ export abstract class ProductPlugin {
|
||||
abstract uninitialize(): void;
|
||||
}
|
||||
|
||||
export function initializeProducts() {
|
||||
return (dispatch: DispatchFunc) => {
|
||||
export function initializeProducts(): ThunkActionFunc<Promise<unknown>> {
|
||||
return (dispatch) => {
|
||||
return Promise.all([
|
||||
dispatch(loadRemoteModules()),
|
||||
dispatch(configureClient()),
|
||||
@@ -23,16 +23,16 @@ export function initializeProducts() {
|
||||
};
|
||||
}
|
||||
|
||||
function configureClient() {
|
||||
function configureClient(): NewActionFuncAsync {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
return (dispatch: DispatchFunc, getState: GetStateFunc) => {
|
||||
return (dispatch, getState) => {
|
||||
return Promise.resolve({data: true});
|
||||
};
|
||||
}
|
||||
|
||||
function loadRemoteModules() {
|
||||
function loadRemoteModules(): NewActionFuncAsync {
|
||||
/* eslint-disable no-console */
|
||||
return async (/*dispatch: DispatchFunc, getState: GetStateFunc*/) => {
|
||||
return async (/*dispatch, getState*/) => {
|
||||
// const config = getConfig(getState());
|
||||
|
||||
/**
|
||||
|
||||
Ссылка в новой задаче
Block a user