alibaba / fish-redux

An assembled flutter application framework.
https://github.com/alibaba/fish-redux
Apache License 2.0
7.33k stars 843 forks source link

父Component使用PrivateReducerMixin,子Component也使用PrivateReducerMixin则子Component的effect有效但是reducer失效。 #547

Closed qq329401134 closed 4 years ago

qq329401134 commented 4 years ago

父:是动态list下的一个动态组件 class DongTaiComponent extends Component with PrivateReducerMixin { DongTaiComponent() : super( view: buildView, effect: buildEffect(), reducer: buildReducer(), dependencies: Dependencies( slots: <String, Dependent>{ 'toupiao': ToupiaoComponentConnector() + ToupiaoComponent(), }), ); } class ToupiaoComponentConnector extends ConnOp<DongTaiComponentState, ToupiaoComponentState> with ReselectMixin<DongTaiComponentState, ToupiaoComponentState> { @override ToupiaoComponentState computed(DongTaiComponentState state) { return ToupiaoComponentState() ..voteItemInfo = state.voteItemInfo ..submitLoading = state.submitLoading ..voteTitle = state.voteTitle; }

@override List factors(DongTaiComponentState state) { return [state.voteItemInfo]; }

@override void set(DongTaiComponentState state, ToupiaoComponentState subState) { state.voteItemInfo = List.from(subState.voteItemInfo); state.submitLoading = subState.submitLoading; state.voteTitle = subState.voteTitle; } }

子是动态组件中的一个投票组件 class ToupiaoComponent extends Component with PrivateReducerMixin { ToupiaoComponent() : super( view: buildView, effect: buildEffect(), reducer: buildReducer(), ); }

在投票组件中的reducer里面打断点断不下来,但是effect可以

qq329401134 commented 4 years ago

在Page中正常使用 class DongTaiDetailPage extends Page<DongTaiDetailPage , Map<String, dynamic>> { DongTaiDetailPage () : super( initState: initState, effect: buildEffect(), reducer: buildReducer(), view: buildView, dependencies: Dependencies( slots: <String, Dependent>{ 'toupiao': ToupiaoComponentConnector() + ToupiaoComponent(), }), ); } 在投票组件中的reducer里面打断点可以断下来 @zjuwjf