-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
refactor search && sorting reducers && actions using redux toolkit #3124
base: develop
Are you sure you want to change the base?
refactor search && sorting reducers && actions using redux toolkit #3124
Conversation
@raclim @lindapaiste I have fixed few errors in this PR, but i don't know why the heck this |
I do! The previous p5.js-web-editor/client/modules/IDE/actions/sorting.js Lines 8 to 16 in 7e08278
The new You're going to have the same problem with the There's two ways to fix it:
I'm using |
return { | ||
...state, | ||
[`${scope}SearchTerm`]: query | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to do ...state
stuff when using Redux Toolkit. The reducer uses a proxy of the actual state so it is okay to mutate it. You can return
a new state to replace the entire state, but typically you just modify the state and don't return
anything. It can be written as:
setSearchTerm: (state, action) => {
const { scope, query } = action.payload;
state[`${scope}SearchTerm`] = query;
}
@lindapaiste @raclim I think the overall functionality works now, we are able to sort and search but one unit-test is getting failed, probably need to look at this one and update as early as possible |
Hey, @lindapaiste , Is the issue open , can I work on this issue? |
Associated issue: #2042
Changes:
constants
createSlice
to rewrite the sorting and search reducersactions/sorting.js
I have verified that this pull request:
npm run lint
)npm run test
)develop
branch.Fixes #123