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
Transform addons reducer/actions/action creators into a ducks module #3025
Conversation
import type { AddonType } from 'core/types/addons'; | ||
|
||
|
||
export const FETCH_ADDON = 'FETCH_ADDON'; |
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.
Do we have a naming pattern for action types btw? poke @tofumatt
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.
We have been inconsistent but we want VERB_NOUN
so FETCH_ADDON
, LOAD_ADDON
, etc. makes sense.
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.
FETCH_ADDON
to trigger the API call, and LOAD_ADDON
to update the state with the API results, is that correct?
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.
Yup, that's what we want. And when starting things like autocomplete or a search it would probably be START_SEARCH
, START_AUTOCOMPLETE
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.
wonderful!
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.
Thanks for doing this. I just have one small change request.
import { createStubErrorHandler } from 'tests/unit/helpers'; | ||
|
||
describe('core.actions.addons', () => { | ||
|
||
describe(__filename, () => { |
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.
I think this file should just be merged into tests/unit/core/reducers/test_addons.js
.
src/core/reducers/addons.js
Outdated
export default function addon(state = initialState, action) { | ||
export default function addon( | ||
state: Object = initialState, | ||
action: Object = {} |
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.
heh, yeah. I will adjust this when fixing the reducer. I'll also move loadEntities
over here but only after bathing it in bleach and renaming it to loadAddons
💥
d'oh. I thought that failure was only in my build. It landed so you can merge in master. |
Thanks for the review, this should be ok now. |
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.
Looks great
Refs mozilla/addons#10708
Edit: fixed by rebase
Current build fails because of a locale test fixed by #3023: