From fcc7d5c016a75f975c1e66c6be708fc8e7a602c6 Mon Sep 17 00:00:00 2001 From: Heinrich Lee Yu Date: Mon, 15 Jul 2019 12:14:37 +0800 Subject: [PATCH] Fix race condition with polling when saving notes eTagPoll may not be initialized yet when we save a note. Polling is initialized only after discussions are loaded --- app/assets/javascripts/notes/stores/actions.js | 4 ++-- changelogs/unreleased/fix-comment-race-condition.yml | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/fix-comment-race-condition.yml diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js index 30eab272aa9..762a87ce0ff 100644 --- a/app/assets/javascripts/notes/stores/actions.js +++ b/app/assets/javascripts/notes/stores/actions.js @@ -357,11 +357,11 @@ export const poll = ({ commit, state, getters, dispatch }) => { }; export const stopPolling = () => { - eTagPoll.stop(); + if (eTagPoll) eTagPoll.stop(); }; export const restartPolling = () => { - eTagPoll.restart(); + if (eTagPoll) eTagPoll.restart(); }; export const fetchData = ({ commit, state, getters }) => { diff --git a/changelogs/unreleased/fix-comment-race-condition.yml b/changelogs/unreleased/fix-comment-race-condition.yml new file mode 100644 index 00000000000..d1f5b8fe01f --- /dev/null +++ b/changelogs/unreleased/fix-comment-race-condition.yml @@ -0,0 +1,5 @@ +--- +title: Fix commenting before discussions are loaded +merge_request: 30724 +author: +type: fixed