From 09098ff307fb76e829f6ac8a6fe0fc080f773657 Mon Sep 17 00:00:00 2001 From: Igor Lobanov Date: Wed, 28 Sep 2022 12:34:21 +0200 Subject: [PATCH] ArticleCard undefined in props error --- src/components/Feed/Card.tsx | 186 +++++++++++++++++------------------ src/stores/zine/articles.ts | 8 +- 2 files changed, 94 insertions(+), 100 deletions(-) diff --git a/src/components/Feed/Card.tsx b/src/components/Feed/Card.tsx index c23e19a2..da9e33a6 100644 --- a/src/components/Feed/Card.tsx +++ b/src/components/Feed/Card.tsx @@ -72,113 +72,109 @@ export const ArticleCard = (props: ArticleCardProps) => { 'shout-card--feed': props.settings?.isFeedMode }} > - - -
-
- {title -
+ +
+
+ {title +
+
+
+ +
+ + -
- -
- - - -
-
- - - - - -
- -
- {title} -
- - -
- {subtitle} -
-
+ +
+ - -
- -
- - {(author, index) => { - const name = - author.name === 'Дискурс' && locale() !== 'ru' - ? 'Discours' - : translit(author.name || '', locale() || 'ru') - - return ( - <> - 0}>, - {name} - - ) - }} - -
-
- - -
{formattedDate()}
-
+
+ +
+ {title}
- - -
- -
- -
+ +
+ +
+ + {(author, index) => { + const name = + author.name === 'Дискурс' && locale() !== 'ru' + ? 'Discours' + : translit(author.name || '', locale() || 'ru') -
- -
+ return ( + <> + 0}>, + {name} + + ) + }} +
+
+
+ + +
{formattedDate()}
+
+
+
+ + +
+
+
+ + {stat?.rating || ''} + +
+
+ + {stat?.viewed} +
+ - -
-
-
- +
+ +
+ +
+ +
+
+ + + +
+
) } diff --git a/src/stores/zine/articles.ts b/src/stores/zine/articles.ts index b8e75123..eb283f5f 100644 --- a/src/stores/zine/articles.ts +++ b/src/stores/zine/articles.ts @@ -217,12 +217,10 @@ type InitialState = { } export const useArticlesStore = (initialState: InitialState = {}) => { - const sortedArticles = [...(initialState.sortedArticles || [])] + addArticles(initialState.sortedArticles || []) - addArticles(sortedArticles) - - if (sortedArticles) { - addSortedArticles(sortedArticles) + if (initialState.sortedArticles) { + setSortedArticles([...initialState.sortedArticles]) } const getArticleEntities = useStore(articleEntitiesStore)