Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
bf2ef24f
Commit
bf2ef24f
authored
Sep 14, 2020
by
Peter Hegman
Committed by
Mark Florian
Sep 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Vuex "Updating complex state" example
parent
2a4b477b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
doc/development/fe_guide/vuex.md
doc/development/fe_guide/vuex.md
+8
-5
No files found.
doc/development/fe_guide/vuex.md
View file @
bf2ef24f
...
...
@@ -216,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:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment