Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
810 views
in Technique[技术] by (71.8m points)

spartacus storefront - Same state in angular with different reducer

we are written new action and a new reducer, new reducer will update the existing state (product state) how to call new reducer when a new action is dispatched and old reducer for old action, but both reducers has to update the same state

question from:https://stackoverflow.com/questions/65846895/same-state-in-angular-with-different-reducer

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If old reducer and action is ok, you shouldn't worry about them. Please create your own action with different type and provide own reducer, based on original one (I mean you can't override function as class, so my proposal is to copy-paste existing one from source code), with your new case which supports that action. StoreModule.forFeature(XXX_FEATURE, yourReducerToken)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...