ui: allow manually set legacy mode

This commit is contained in:
undefined committed 2023-01-10 05:20:23 +08:00
1 parent e5de4f101b
commit cca5cb895e
6 files changed
+32 -18

No files matched your search

+8 -7
View File
@@ -1,13 +1,14 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import type { Action, AnyAction, Reducer } from 'redux';
export default async function loadReactRedux<S, A extends Action = AnyAction>(storeReducer: Reducer<S, A>) {
const React = await import('react');
const { createRoot } = await import('react-dom/client');
const { Provider } = await import('react-redux');
const { createStore, applyMiddleware } = await import('redux');
const { default: reduxThunk } = await import('redux-thunk');
const { default: reduxPromise } = await import('redux-promise-middleware');
const [{ Provider }, { createStore, applyMiddleware }, { default: reduxThunk }, { default: reduxPromise }] = await Promise.all([
import('react-redux'),
import('redux'),
import('redux-thunk'),
import('redux-promise-middleware'),
]);
const reduxMiddlewares = [];
reduxMiddlewares.push(reduxThunk);
reduxMiddlewares.push(reduxPromise);