Skip to content

Commit edd69f8

Browse files
Merge pull request #1819 from MetRonnie/event-bus
Clean up event listener; fix warning in test
2 parents 4f2de6a + 87d8e88 commit edd69f8

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/components/cylc/workspace/Widget.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2525
</template>
2626

2727
<script setup>
28-
import { provide, readonly, ref } from 'vue'
28+
import { onBeforeUnmount, provide, readonly, ref } from 'vue'
2929
import { eventBus } from '@/services/eventBus'
3030
3131
const props = defineProps({
@@ -50,4 +50,8 @@ provide('animResetTime', readonly(animResetTime))
5050
eventBus.on(`lumino:show:${props.id}`, () => {
5151
animResetTime.value = Date.now()
5252
})
53+
54+
onBeforeUnmount(() => {
55+
eventBus.off(`lumino:show:${props.id}`)
56+
})
5357
</script>

tests/unit/components/cylc/gscan/gscan.vue.spec.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
*/
1717

1818
import { mount } from '@vue/test-utils'
19-
import { createStore } from 'vuex'
2019
import { createVuetify } from 'vuetify'
21-
import storeOptions from '@/store/options'
2220
import GScan from '@/components/cylc/gscan/GScan.vue'
2321
import CommandMenuPlugin from '@/components/cylc/commandMenu/plugin'
2422
import {
@@ -49,12 +47,6 @@ function filterNodes (wrapper, filteredOutNodesCache) {
4947
}
5048

5149
describe('GScan component', () => {
52-
const store = createStore(storeOptions)
53-
const resetState = () => {
54-
store.commit('workflows/SET_WORKFLOW_NAME', null)
55-
}
56-
beforeEach(resetState)
57-
5850
describe('Sorting', () => {
5951
it('sets workflow sort order by status', () => {
6052
// for each worflow state ...

0 commit comments

Comments
 (0)