Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
961 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 Reply

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...