-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to access a reducer of same logic into other logic. #156
Comments
I tried using setFilter: (state, { index, property }) => {
const newFilters: AnyPropertyFilter[] = [...state]
const cachedProperty = values.filtersOperatorsCache?.[index][property.operator]
newFilters[index] = cachedProperty ? cachedProperty : property
return newFilters
}, but I am getting an error Uncaught Error: You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.
at Object.getState (redux.js:196:13)
at Object.a [as getState] (<anonymous>:1:38452)
at getStoreState2 (index.cjs.js:1013:29)
at Object.get [as filtersOperatorsCache] (index.cjs.js:1744:37)
at Object.setFilter [as set filter (lib.components.PropertyFilters.propertyFilterLogic.0-$pageview-trends_TRENDS_data_exploration-filter)] (propertyFilterLogic.ts:54:40) |
You can't access other values inside a reducer. You can either pass in these values as part of an action, or use a listener for more complex logic flow. |
Got it @mariusandra |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Let us say I have following code
I want to access
filtersOperatorsCache
insidesetFilter
offilters
reducer. How to do that.The text was updated successfully, but these errors were encountered: