From 1a88ef109a666cf314cee3e6383fbb870c4178d5 Mon Sep 17 00:00:00 2001 From: Igor Lobanov Date: Mon, 17 Oct 2022 19:09:45 +0200 Subject: [PATCH] hot fixes --- src/components/Views/AllAuthors.tsx | 5 +++++ .../{article-reactions.ts => article-reactions.ts.bak} | 0 src/graphql/types.gen.ts | 7 ------- src/utils/apiClient.ts | 7 +++---- 4 files changed, 8 insertions(+), 11 deletions(-) rename src/graphql/query/{article-reactions.ts => article-reactions.ts.bak} (100%) diff --git a/src/components/Views/AllAuthors.tsx b/src/components/Views/AllAuthors.tsx index 3273b7b3..96f824e0 100644 --- a/src/components/Views/AllAuthors.tsx +++ b/src/components/Views/AllAuthors.tsx @@ -35,6 +35,11 @@ export const AllAuthorsView = (props: Props) => { const byLetter = createMemo<{ [letter: string]: Author[] }>(() => { return sortedAuthors().reduce((acc, author) => { + if (!author.name) { + // name === null for new users + return acc + } + const letter = author.name[0].toUpperCase() if (!acc[letter]) { acc[letter] = [] diff --git a/src/graphql/query/article-reactions.ts b/src/graphql/query/article-reactions.ts.bak similarity index 100% rename from src/graphql/query/article-reactions.ts rename to src/graphql/query/article-reactions.ts.bak diff --git a/src/graphql/types.gen.ts b/src/graphql/types.gen.ts index 3ef4b19c..59b0f1b2 100644 --- a/src/graphql/types.gen.ts +++ b/src/graphql/types.gen.ts @@ -347,7 +347,6 @@ export type Query = { markdownBody: Scalars['String'] myChats: Array> reactionsByAuthor: Array> - reactionsByShout: Array> reactionsForShouts: Array> recentAll: Array> recentCandidates: Array> @@ -422,12 +421,6 @@ export type QueryReactionsByAuthorArgs = { slug: Scalars['String'] } -export type QueryReactionsByShoutArgs = { - limit: Scalars['Int'] - offset: Scalars['Int'] - slug: Scalars['String'] -} - export type QueryReactionsForShoutsArgs = { limit: Scalars['Int'] offset: Scalars['Int'] diff --git a/src/utils/apiClient.ts b/src/utils/apiClient.ts index be9e29b5..55373fe0 100644 --- a/src/utils/apiClient.ts +++ b/src/utils/apiClient.ts @@ -4,7 +4,6 @@ import { getLogger } from './logger' import { publicGraphQLClient } from '../graphql/publicGraphQLClient' import { privateGraphQLClient } from '../graphql/privateGraphQLClient' import articleBySlug from '../graphql/query/article-by-slug' -import articleReactions from '../graphql/query/article-reactions' import articlesRecentAll from '../graphql/query/articles-recent-all' import articlesRecentPublished from '../graphql/query/articles-recent-published' import topicsAll from '../graphql/query/topics-all' @@ -285,14 +284,14 @@ export const apiClient = { offset: number }): Promise => { const response = await publicGraphQLClient - .query(articleReactions, { - slug: articleSlug, + .query(reactionsForShouts, { + shouts: [articleSlug], limit, offset }) .toPromise() - return response.data?.reactionsByShout + return response.data?.reactionsForShouts }, getAuthorsBySlugs: async ({ slugs }) => { const response = await publicGraphQLClient.query(authorsBySlugs, { slugs }).toPromise()