From 8c0372803c2229b5f88b8924c07fbb03c262da51 Mon Sep 17 00:00:00 2001 From: wangxinrong <18629193282@163.com> Date: Wed, 1 Nov 2023 21:56:49 +0800 Subject: [PATCH] =?UTF-8?q?[inulax]=20history=E5=8F=82=E6=95=B0=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inula-router/src/router/withRouter.tsx | 5 ++--- .../inula/src/inulax/adapters/reduxReact.ts | 21 +++++-------------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/packages/inula-router/src/router/withRouter.tsx b/packages/inula-router/src/router/withRouter.tsx index 43f7dc01..3d7f58bd 100644 --- a/packages/inula-router/src/router/withRouter.tsx +++ b/packages/inula-router/src/router/withRouter.tsx @@ -20,14 +20,13 @@ import RouterContext from './context'; function withRouter(Component: C) { function ComponentWithRouterProp(props: any) { - const { wrappedComponentRef, ...rest } = props; const { history, location, match } = useContext(RouterContext); const routeProps = { history: history, location: location, match: match }; - return ; + return ; } return ComponentWithRouterProp; } -export default withRouter; +export default withRouter; \ No newline at end of file diff --git a/packages/inula/src/inulax/adapters/reduxReact.ts b/packages/inula/src/inulax/adapters/reduxReact.ts index 203622f3..51650f98 100644 --- a/packages/inula/src/inulax/adapters/reduxReact.ts +++ b/packages/inula/src/inulax/adapters/reduxReact.ts @@ -17,7 +17,6 @@ import { useState, useContext, useEffect, useRef } from '../../renderer/hooks/Ho import { createContext } from '../../renderer/components/context/CreateContext'; import { createElement } from '../../external/JSXElement'; import type { ReduxStoreHandler, ReduxAction, BoundActionCreator } from './redux'; -import { forwardRef } from '../../renderer/components/ForwardRef'; const DefaultContext = createContext(null); type Context = typeof DefaultContext; @@ -91,11 +90,6 @@ type MergePropsP = ( type WrappedComponent = (props: OwnProps) => ReturnType; type OriginalComponent = (props: MergedProps) => ReturnType; type Connector = (Component: OriginalComponent) => WrappedComponent; -type ConnectOption = { - areStatesEqual?: (oldState: State, newState: State) => boolean; - context?: Context; - forwardRef?: boolean -} export function connect( mapStateToProps: MapStateToPropsP = () => ({} as StateProps), @@ -103,9 +97,12 @@ export function connect( mergeProps: MergePropsP = ( stateProps, dispatchProps, - ownProps, + ownProps ): MergedProps => ({ ...stateProps, ...dispatchProps, ...ownProps } as unknown as MergedProps), - options: ConnectOption, + options?: { + areStatesEqual?: (oldState: any, newState: any) => boolean; + context?: Context; + } ): Connector { if (!options) { options = {}; @@ -162,7 +159,6 @@ export function connect( mappedDispatch = mapDispatchToProps(store.dispatch, props); } } - mappedDispatch = Object.assign({}, mappedDispatch, { dispatch: store.dispatch }); const mergedProps = ( mergeProps || ((state, dispatch, originalProps) => { @@ -176,13 +172,6 @@ export function connect( return node; }; - if (options.forwardRef) { - const forwarded = forwardRef(function (props, ref) { - return Wrapper({ ...props, ref: ref }); - }); - return forwarded as WrappedComponent; - } - return Wrapper; }; }