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
9e3c7109
Commit
9e3c7109
authored
Sep 10, 2020
by
David O'Regan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update cache to be immutable
parent
cf6e1344
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
app/assets/javascripts/alert_management/components/sidebar/sidebar_todo.vue
...ipts/alert_management/components/sidebar/sidebar_todo.vue
+6
-2
app/assets/javascripts/alert_management/details.js
app/assets/javascripts/alert_management/details.js
+7
-2
No files found.
app/assets/javascripts/alert_management/components/sidebar/sidebar_todo.vue
View file @
9e3c7109
<
script
>
<
script
>
import
produce
from
'
immer
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
s__
}
from
'
~/locale
'
;
import
Todo
from
'
~/sidebar/components/todo_toggle/todo.vue
'
;
import
Todo
from
'
~/sidebar/components/todo_toggle/todo.vue
'
;
import
createAlertTodoMutation
from
'
../../graphql/mutations/alert_todo_create.mutation.graphql
'
;
import
createAlertTodoMutation
from
'
../../graphql/mutations/alert_todo_create.mutation.graphql
'
;
...
@@ -109,12 +110,15 @@ export default {
...
@@ -109,12 +110,15 @@ export default {
});
});
},
},
updateCache
(
store
)
{
updateCache
(
store
)
{
const
d
ata
=
store
.
readQuery
({
const
sourceD
ata
=
store
.
readQuery
({
query
:
alertQuery
,
query
:
alertQuery
,
variables
:
this
.
getAlertQueryVariables
,
variables
:
this
.
getAlertQueryVariables
,
});
});
data
.
project
.
alertManagementAlerts
.
nodes
[
0
].
todos
.
nodes
.
shift
();
const
data
=
produce
(
sourceData
,
draftData
=>
{
// eslint-disable-next-line no-param-reassign
draftData
.
project
.
alertManagementAlerts
.
nodes
[
0
].
todos
.
nodes
=
[];
});
store
.
writeQuery
({
store
.
writeQuery
({
query
:
alertQuery
,
query
:
alertQuery
,
...
...
app/assets/javascripts/alert_management/details.js
View file @
9e3c7109
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
produce
from
'
immer
'
;
import
{
defaultDataIdFromObject
}
from
'
apollo-cache-inmemory
'
;
import
{
defaultDataIdFromObject
}
from
'
apollo-cache-inmemory
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
createRouter
from
'
./router
'
;
import
createRouter
from
'
./router
'
;
...
@@ -16,8 +17,11 @@ export default selector => {
...
@@ -16,8 +17,11 @@ export default selector => {
const
resolvers
=
{
const
resolvers
=
{
Mutation
:
{
Mutation
:
{
toggleSidebarStatus
:
(
_
,
__
,
{
cache
})
=>
{
toggleSidebarStatus
:
(
_
,
__
,
{
cache
})
=>
{
const
data
=
cache
.
readQuery
({
query
:
sidebarStatusQuery
});
const
sourceData
=
cache
.
readQuery
({
query
:
sidebarStatusQuery
});
data
.
sidebarStatus
=
!
data
.
sidebarStatus
;
const
data
=
produce
(
sourceData
,
draftData
=>
{
// eslint-disable-next-line no-param-reassign
draftData
.
sidebarStatus
=
!
draftData
.
sidebarStatus
;
});
cache
.
writeQuery
({
query
:
sidebarStatusQuery
,
data
});
cache
.
writeQuery
({
query
:
sidebarStatusQuery
,
data
});
},
},
},
},
...
@@ -34,6 +38,7 @@ export default selector => {
...
@@ -34,6 +38,7 @@ export default selector => {
return
defaultDataIdFromObject
(
object
);
return
defaultDataIdFromObject
(
object
);
},
},
},
},
assumeImmutableResults
:
true
,
}),
}),
});
});
...
...
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