diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /doc/development/fe_guide/vuex.md | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) | |
download | gitlab-ce-85dc423f7090da0a52c73eb66faf22ddb20efff9.tar.gz |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'doc/development/fe_guide/vuex.md')
-rw-r--r-- | doc/development/fe_guide/vuex.md | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/doc/development/fe_guide/vuex.md b/doc/development/fe_guide/vuex.md index 9573dd36e63..4badf3f0845 100644 --- a/doc/development/fe_guide/vuex.md +++ b/doc/development/fe_guide/vuex.md @@ -55,10 +55,6 @@ export const createStore = () => }); ``` -_Note:_ Until this -[RFC](https://gitlab.com/gitlab-org/frontend/rfcs/-/issues/20) is implemented, -the above will need to disable the `import/prefer-default-export` ESLint rule. - ### `state.js` The first thing you should do before writing any code is to design the state. @@ -220,12 +216,15 @@ A mutation written like this is harder to maintain and more error prone. We shou // Good export default { [types.MARK_AS_CLOSED](state, itemId) { - const item = state.items.find(i => i.id == itemId); - Vue.set(item, 'closed', true) + const item = state.items.find(x => x.id === itemId); - state.items.splice(index, 1, item) - } -} + if (!item) { + return; + } + + Vue.set(item, 'closed', true); + }, +}; ``` This approach is better because: |