-
Notifications
You must be signed in to change notification settings - Fork 63
Conversation
Nearly a hundred files changed! That'll be an intense review (although all checks passed so that's a good sign). |
I guess I should exchange this intense review with the review of WordPress/openverse-api#194 :) With all store modules becoming namespaced, all calls of |
@obulat I haven't read this yet but it appears to talk about mocking namespaced actions https://al-un.github.io/learn-nuxt-ts/06.test.html#mocking-vuex-store I'll check later when I review this. So much work! That's why I didn't do this as part of the original Nuxt migration 😅 |
# Conflicts: # src/constants/mutation-types.js # src/middleware/middleware.js # src/store-modules/nav-store.js # src/store/active-media-store.js # src/store/index.js
...mapActions({ | ||
fetchMedia: `${SEARCH}/${FETCH_MEDIA}`, | ||
}), |
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.
For binding namespaced actions, provide the name of the module as the first argument for the mapActions
call.
...mapActions({ | |
fetchMedia: `${SEARCH}/${FETCH_MEDIA}`, | |
}), | |
...mapActions(SEARCH, [ | |
FETCH_MEDIA, | |
]), |
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.
Ooh, that's a great suggestion @dhruvkb I didn't know you could do that. Bye string concatenation!
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 like mapActions because they allow us to use the actions by calling them just like regular Vue methods.
In this case, we can write this.fetchMedia()
instead of this[FETCH_MEDIA]()
.
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.
In that case we can do
...mapActions(SEARCH, {
fetchMedia: FETCH_MEDIA
}),
Fixes
Fixes #205 by @dhruvkb
Description
This PR refactors one mega-store that we currently have into namespaced modules inside the
store
directory.Technical details
Tests
Screenshots
Checklist
Update index.md
).main
ormaster
).Developer Certificate of Origin
Developer Certificate of Origin