Fixed stashed check breaking on empty stashes in PostGraphile plugins.
This commit is contained in:
parent
76a5ccf3f6
commit
c70f500acc
|
@ -25,14 +25,14 @@ const schemaExtender = makeExtendSchemaPlugin(_build => ({
|
||||||
resolvers: {
|
resolvers: {
|
||||||
Actor: {
|
Actor: {
|
||||||
isFavorited(parent) {
|
isFavorited(parent) {
|
||||||
if (!parent['@stashes'] || typeof parent['@stashes'][0]['@stash'].primary === 'undefined') {
|
if (!parent['@stashes'] || (parent['@stashes'].length > 0 && typeof parent['@stashes'][0]['@stash'].primary === 'undefined')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent['@stashes'].some(({ '@stash': stash }) => stash.primary);
|
return parent['@stashes'].some(({ '@stash': stash }) => stash.primary);
|
||||||
},
|
},
|
||||||
isStashed(parent, args) {
|
isStashed(parent, args) {
|
||||||
if (!parent['@stashes'] || typeof parent['@stashes'][0]['@stash'].primary === 'undefined') {
|
if (!parent['@stashes'] || (parent['@stashes'].length > 0 && typeof parent['@stashes'][0]['@stash'].primary === 'undefined')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,14 +12,14 @@ const schemaExtender = makeExtendSchemaPlugin(_build => ({
|
||||||
resolvers: {
|
resolvers: {
|
||||||
Release: {
|
Release: {
|
||||||
isFavorited(parent) {
|
isFavorited(parent) {
|
||||||
if (!parent['@stashes'] || typeof parent['@stashes'][0]['@stash'].primary === 'undefined') {
|
if (!parent['@stashes'] || (parent['@stashes'].length > 0 && typeof parent['@stashes'][0]['@stash'].primary === 'undefined')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent['@stashes'].some(({ '@stash': stash }) => stash.primary);
|
return parent['@stashes'].some(({ '@stash': stash }) => stash.primary);
|
||||||
},
|
},
|
||||||
isStashed(parent, args) {
|
isStashed(parent, args) {
|
||||||
if (!parent['@stashes'] || typeof parent['@stashes'][0]['@stash'].primary === 'undefined') {
|
if (!parent['@stashes'] || (parent['@stashes'].length > 0 && typeof parent['@stashes'][0]['@stash'].primary === 'undefined')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue