Skip to content

Commit

Permalink
Ignore les versions qui n'existent plus
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Jul 3, 2023
1 parent 91722a4 commit 3f8344d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion graphql/resolvers/articleResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,10 @@ module.exports = {
},

async versions (article, _args, context) {
const versions = await Promise.all(article.versions.map(async (versionId) => await context.loaders.versions.load(versionId)))
const versions = (await Promise.all(
article.versions.map(async (versionId) => await context.loaders.versions.load(versionId))
)
).filter((v) => v) // ignore unresolved versions
versions.sort((a, b) => b.createdAt - a.createdAt)
return versions
},
Expand Down

0 comments on commit 3f8344d

Please sign in to comment.