check existance of teamCollectionAdded.parent

Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
Liyas Thomas
2021-05-02 03:49:00 +00:00
committed by GitHub
parent 597fd2c6d1
commit b8bc110d33
2 changed files with 13 additions and 4 deletions

View File

@@ -110,7 +110,7 @@
@click="confirmRemove = true" @click="confirmRemove = true"
v-close-popover v-close-popover
> >
<i class="material-icons">add</i> <i class="material-icons">delete</i>
<span>{{ $t("delete") }}</span> <span>{{ $t("delete") }}</span>
</button> </button>
<button v-else class="icon" @click="confirmRemove = true" v-close-popover> <button v-else class="icon" @click="confirmRemove = true" v-close-popover>
@@ -384,9 +384,12 @@ export default {
return { teamID: this.$props.collectionsType.selectedTeam.id } return { teamID: this.$props.collectionsType.selectedTeam.id }
}, },
skip() { skip() {
return this.$props.collectionsType.selectedTeam === undefined return (
this.$props.collectionsType.selectedTeam === undefined && this.$props.showChildren
)
}, },
updateQuery(previousResult, { subscriptionData }) { updateQuery(previousResult, { subscriptionData }) {
debugger
if ( if (
subscriptionData.data.teamCollectionAdded.parent && subscriptionData.data.teamCollectionAdded.parent &&
subscriptionData.data.teamCollectionAdded.parent.id === this.$props.collection.id subscriptionData.data.teamCollectionAdded.parent.id === this.$props.collection.id

View File

@@ -236,7 +236,10 @@ export default {
return this.$props.collectionsType.selectedTeam === undefined return this.$props.collectionsType.selectedTeam === undefined
}, },
updateQuery(previousResult, { subscriptionData }) { updateQuery(previousResult, { subscriptionData }) {
if (subscriptionData.data.teamCollectionAdded.parent.id === this.$props.folder.id) { if (
subscriptionData.data.teamCollectionAdded.parent &&
subscriptionData.data.teamCollectionAdded.parent.id === this.$props.folder.id
) {
previousResult.collection.children.push({ previousResult.collection.children.push({
id: subscriptionData.data.teamCollectionAdded.id, id: subscriptionData.data.teamCollectionAdded.id,
title: subscriptionData.data.teamCollectionAdded.title, title: subscriptionData.data.teamCollectionAdded.title,
@@ -266,7 +269,10 @@ export default {
return this.$props.collectionsType.selectedTeam === undefined return this.$props.collectionsType.selectedTeam === undefined
}, },
updateQuery(previousResult, { subscriptionData }) { updateQuery(previousResult, { subscriptionData }) {
if (subscriptionData.data.teamCollectionUpdated.parent.id === this.$props.folder.id) { if (
subscriptionData.data.teamCollectionUpdated.parent &&
subscriptionData.data.teamCollectionUpdated.parent.id === this.$props.folder.id
) {
const index = previousResult.collection.children.findIndex( const index = previousResult.collection.children.findIndex(
(x) => x.id === subscriptionData.data.teamCollectionUpdated.id (x) => x.id === subscriptionData.data.teamCollectionUpdated.id
) )