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
4212ab48
Commit
4212ab48
authored
May 08, 2020
by
Scott Stern
Committed by
Natalia Tepluhina
May 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unsubscribe from websocket when component unmounts
parent
0c4df6a7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
app/assets/javascripts/sidebar/components/assignees/assignees_realtime.vue
...ripts/sidebar/components/assignees/assignees_realtime.vue
+5
-1
spec/frontend/sidebar/assignees_realtime_spec.js
spec/frontend/sidebar/assignees_realtime_spec.js
+3
-1
No files found.
app/assets/javascripts/sidebar/components/assignees/assignees_realtime.vue
View file @
4212ab48
...
@@ -4,6 +4,7 @@ import query from '~/issuable_sidebar/queries/issue_sidebar.query.graphql';
...
@@ -4,6 +4,7 @@ import query from '~/issuable_sidebar/queries/issue_sidebar.query.graphql';
import
actionCable
from
'
~/actioncable_consumer
'
;
import
actionCable
from
'
~/actioncable_consumer
'
;
export
default
{
export
default
{
subscription
:
null
,
name
:
'
AssigneesRealtime
'
,
name
:
'
AssigneesRealtime
'
,
props
:
{
props
:
{
mediator
:
{
mediator
:
{
...
@@ -36,6 +37,9 @@ export default {
...
@@ -36,6 +37,9 @@ export default {
mounted
()
{
mounted
()
{
this
.
initActionCablePolling
();
this
.
initActionCablePolling
();
},
},
beforeDestroy
()
{
this
.
$options
.
subscription
.
unsubscribe
();
},
methods
:
{
methods
:
{
received
(
data
)
{
received
(
data
)
{
if
(
data
.
event
===
'
updated
'
)
{
if
(
data
.
event
===
'
updated
'
)
{
...
@@ -43,7 +47,7 @@ export default {
...
@@ -43,7 +47,7 @@ export default {
}
}
},
},
initActionCablePolling
()
{
initActionCablePolling
()
{
actionCable
.
subscriptions
.
create
(
this
.
$options
.
subscription
=
actionCable
.
subscriptions
.
create
(
{
{
channel
:
'
IssuesChannel
'
,
channel
:
'
IssuesChannel
'
,
project_path
:
this
.
projectPath
,
project_path
:
this
.
projectPath
,
...
...
spec/frontend/sidebar/assignees_realtime_spec.js
View file @
4212ab48
...
@@ -6,7 +6,9 @@ import Mock from './mock_data';
...
@@ -6,7 +6,9 @@ import Mock from './mock_data';
import
query
from
'
~/issuable_sidebar/queries/issue_sidebar.query.graphql
'
;
import
query
from
'
~/issuable_sidebar/queries/issue_sidebar.query.graphql
'
;
jest
.
mock
(
'
@rails/actioncable
'
,
()
=>
{
jest
.
mock
(
'
@rails/actioncable
'
,
()
=>
{
const
mockConsumer
=
{
subscriptions
:
{
create
:
jest
.
fn
()
}
};
const
mockConsumer
=
{
subscriptions
:
{
create
:
jest
.
fn
().
mockReturnValue
({
unsubscribe
:
jest
.
fn
()
})
},
};
return
{
return
{
createConsumer
:
jest
.
fn
().
mockReturnValue
(
mockConsumer
),
createConsumer
:
jest
.
fn
().
mockReturnValue
(
mockConsumer
),
};
};
...
...
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