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

@@ -236,7 +236,10 @@ export default {
return this.$props.collectionsType.selectedTeam === undefined
},
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({
id: subscriptionData.data.teamCollectionAdded.id,
title: subscriptionData.data.teamCollectionAdded.title,
@@ -266,7 +269,10 @@ export default {
return this.$props.collectionsType.selectedTeam === undefined
},
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(
(x) => x.id === subscriptionData.data.teamCollectionUpdated.id
)