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
2b6443ba
Commit
2b6443ba
authored
May 13, 2020
by
Florie Guibert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Roadmap - Refactor VueX action/mutation to improve performance
parent
13ee246a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
6 deletions
+9
-6
ee/app/assets/javascripts/roadmap/store/actions.js
ee/app/assets/javascripts/roadmap/store/actions.js
+4
-1
ee/app/assets/javascripts/roadmap/store/mutations.js
ee/app/assets/javascripts/roadmap/store/mutations.js
+2
-2
ee/spec/frontend/roadmap/store/actions_spec.js
ee/spec/frontend/roadmap/store/actions_spec.js
+2
-2
ee/spec/frontend/roadmap/store/mutations_spec.js
ee/spec/frontend/roadmap/store/mutations_spec.js
+1
-1
No files found.
ee/app/assets/javascripts/roadmap/store/actions.js
View file @
2b6443ba
...
...
@@ -81,6 +81,7 @@ export const receiveEpicsSuccess = (
{
commit
,
dispatch
,
state
,
getters
},
{
rawEpics
,
newEpic
,
timeframeExtended
},
)
=>
{
const
epicIds
=
[];
const
epics
=
rawEpics
.
reduce
((
filteredEpics
,
epic
)
=>
{
const
formattedEpic
=
roadmapItemUtils
.
formatRoadmapItemDetails
(
epic
,
...
...
@@ -100,11 +101,13 @@ export const receiveEpicsSuccess = (
newEpic
,
});
filteredEpics
.
push
(
formattedEpic
);
commit
(
types
.
UPDATE_EPIC_IDS
,
formattedEpic
.
id
);
epicIds
.
push
(
formattedEpic
.
id
);
}
return
filteredEpics
;
},
[]);
commit
(
types
.
UPDATE_EPIC_IDS
,
epicIds
);
if
(
timeframeExtended
)
{
const
updatedEpics
=
state
.
epics
.
concat
(
epics
);
sortEpics
(
updatedEpics
,
state
.
sortedBy
);
...
...
ee/app/assets/javascripts/roadmap/store/mutations.js
View file @
2b6443ba
...
...
@@ -11,8 +11,8 @@ export default {
state
.
epics
=
epics
;
},
[
types
.
UPDATE_EPIC_IDS
](
state
,
epicId
)
{
state
.
epicIds
.
push
(
epicId
);
[
types
.
UPDATE_EPIC_IDS
](
state
,
epicId
s
)
{
state
.
epicIds
.
push
(
...
epicIds
);
},
[
types
.
REQUEST_EPICS
](
state
)
{
...
...
ee/spec/frontend/roadmap/store/actions_spec.js
View file @
2b6443ba
...
...
@@ -94,7 +94,7 @@ describe('Roadmap Vuex Actions', () => {
},
state
,
[
{
type
:
types
.
UPDATE_EPIC_IDS
,
payload
:
mockRawEpic
.
id
},
{
type
:
types
.
UPDATE_EPIC_IDS
,
payload
:
[
mockRawEpic
.
id
]
},
{
type
:
types
.
RECEIVE_EPICS_SUCCESS
,
payload
:
[
...
...
@@ -149,7 +149,7 @@ describe('Roadmap Vuex Actions', () => {
},
state
,
[
{
type
:
types
.
UPDATE_EPIC_IDS
,
payload
:
mockRawEpic
.
id
},
{
type
:
types
.
UPDATE_EPIC_IDS
,
payload
:
[
mockRawEpic
.
id
]
},
{
type
:
types
.
RECEIVE_EPICS_FOR_TIMEFRAME_SUCCESS
,
payload
:
[{
...
mockFormattedEpic
,
newEpic
:
true
}],
...
...
ee/spec/frontend/roadmap/store/mutations_spec.js
View file @
2b6443ba
...
...
@@ -49,7 +49,7 @@ describe('Roadmap Store Mutations', () => {
describe
(
'
UPDATE_EPIC_IDS
'
,
()
=>
{
it
(
'
Should insert provided epicId to epicIds array in state
'
,
()
=>
{
mutations
[
types
.
UPDATE_EPIC_IDS
](
state
,
22
);
mutations
[
types
.
UPDATE_EPIC_IDS
](
state
,
[
22
]
);
expect
(
state
.
epicIds
).
toHaveLength
(
1
);
expect
(
state
.
epicIds
[
0
]).
toBe
(
22
);
...
...
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