-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 loading actions #2996
Refactor loading actions #2996
Conversation
This is good stuff but I think that I need to explain my There was a situation that was previously occurring where the sketch list would go into a loading state when you clicked the "add to collection" dropdown, as the "Add to collection" modal has its own API call which sets the global |
@@ -33,9 +33,9 @@ describe('projects action creator tests', () => { | |||
store = mockStore(initialTestState); | |||
|
|||
const expectedActions = [ | |||
{ type: ActionTypes.START_LOADING }, | |||
{ type: 'loading/startLoader' }, |
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.
Either of these should work:
{ type: startLoader.type },
startLoader(),
startLoader()
is an action creator, so it's a function that returns the action. If you just call that function without dispatching you will get the value { type: 'loading/startLoader' }
.
dispatch(startLoader()); | ||
dispatch(getCollections(username)).then(() => dispatch(stopLoader())); |
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.
Check out the source of the getCollections
thunk. I think that it dispatches startLoader
and stopLoader
on its own already?
client/modules/Legal/pages/Legal.jsx
Outdated
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.
This one is subjective. Personally I would use the local component state. The policy loading state is not used in any other component so I don't think that it needs to be in a global Redux state.
…ist, AddToCollectionSketchList and Legal components
I have reverted the changes made in the AddToCollectionList, AddToCollectionSketchList, and Legal. I will create a new PR to implement them using the RTK query. Also made the change that you requested in the project.test file. Thanks for the feedback. |
Progress on #2042
Changes:
I have verified that this pull request:
npm run lint
)npm run test
)develop
branch.Fixes #123