From b1b17866ff4cee79d95ba448d72a7cfb31dc8755 Mon Sep 17 00:00:00 2001 From: Liana Harris <46411498+LianaHarris360@users.noreply.github.com> Date: Fri, 13 Sep 2024 11:13:12 -0500 Subject: [PATCH 1/3] Add a rootId watcher to TreeViewBase --- .../channelEdit/views/TreeView/TreeViewBase.vue | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue b/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue index 4b3d75f26f..1e74155345 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue @@ -465,6 +465,12 @@ return DropEffect.COPY; }, }, + watch: { + rootId: { + handler: 'reloadChannel', + immediate: true, + }, + }, methods: { ...mapActions('channel', ['deleteChannel']), handleDelete() { @@ -491,6 +497,13 @@ trackClickEvent(eventLabel) { this.$analytics.trackClick('channel_editor_toolbar', eventLabel); }, + reloadChannel(id) { + if (!id) { + this.$store.dispatch('currentChannel/loadChannel').catch(error => { + throw new Error(error); + }); + } + }, }, $trs: { channelDetails: 'View channel details', From fac36cf5c0ffad01c50d77431f704111345ef799 Mon Sep 17 00:00:00 2001 From: Liana Harris <46411498+LianaHarris360@users.noreply.github.com> Date: Fri, 13 Sep 2024 11:13:33 -0500 Subject: [PATCH 2/3] implement conditional rendering of StudioTree based on the existence of rootId --- .../frontend/channelEdit/views/TreeView/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/index.vue b/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/index.vue index 38a17d2a0c..9d36a109aa 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/index.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/index.vue @@ -89,7 +89,7 @@
Date: Tue, 17 Sep 2024 10:11:46 -0500 Subject: [PATCH 3/3] Use mapActions to load current channel --- .../channelEdit/views/TreeView/TreeViewBase.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue b/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue index 1e74155345..2de7cae031 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue @@ -467,12 +467,19 @@ }, watch: { rootId: { - handler: 'reloadChannel', + handler(id) { + if (!id) { + this.loadChannel().catch(() => { + this.$store.dispatch('showSnackbarSimple', 'Failed to load channel'); + }); + } + }, immediate: true, }, }, methods: { ...mapActions('channel', ['deleteChannel']), + ...mapActions('currentChannel', ['loadChannel']), handleDelete() { this.deleteChannel(this.currentChannel.id).then(() => { localStorage.snackbar = this.$tr('channelDeletedSnackbar'); @@ -497,13 +504,6 @@ trackClickEvent(eventLabel) { this.$analytics.trackClick('channel_editor_toolbar', eventLabel); }, - reloadChannel(id) { - if (!id) { - this.$store.dispatch('currentChannel/loadChannel').catch(error => { - throw new Error(error); - }); - } - }, }, $trs: { channelDetails: 'View channel details',