From 4e2152b8b0b77ec256c5c3c966970227947eab70 Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 7 Mar 2024 15:49:28 +0300 Subject: [PATCH] postmerge-fix --- src/components/Article/RatingControl.tsx | 2 +- src/components/Nav/AuthModal/LoginForm.tsx | 2 +- src/context/reactions.tsx | 44 +++++++++++----------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/components/Article/RatingControl.tsx b/src/components/Article/RatingControl.tsx index 8e424057..289f6416 100644 --- a/src/components/Article/RatingControl.tsx +++ b/src/components/Article/RatingControl.tsx @@ -57,7 +57,7 @@ export const RatingControl = (props: RatingControlProps) => { ) createEffect( on( - reactionEntities, + () => reactionEntities, (reactions) => { const ratings = Object.values(reactions).filter((r) => !r?.reply_to) const likes = ratings.filter((rating) => rating.kind === 'LIKE').length diff --git a/src/components/Nav/AuthModal/LoginForm.tsx b/src/components/Nav/AuthModal/LoginForm.tsx index 4ea5a5f6..d8deabca 100644 --- a/src/components/Nav/AuthModal/LoginForm.tsx +++ b/src/components/Nav/AuthModal/LoginForm.tsx @@ -160,7 +160,7 @@ export const LoginForm = () => { /> -
{submitError()}
+
{submitError()}
diff --git a/src/context/reactions.tsx b/src/context/reactions.tsx index 07b36e7d..34b0cc99 100644 --- a/src/context/reactions.tsx +++ b/src/context/reactions.tsx @@ -1,6 +1,6 @@ -import type { Accessor, JSX } from 'solid-js' +import type { JSX } from 'solid-js' -import { createContext, createSignal, onCleanup, useContext } from 'solid-js' +import { createContext, onCleanup, useContext } from 'solid-js' import { createStore, reconcile } from 'solid-js/store' import { apiClient } from '../graphql/client/core' @@ -9,12 +9,12 @@ import { useLocalize } from './localize' import { useSnackbar } from './snackbar' type ReactionsContextType = { - reactionEntities: Accessor> + reactionEntities: Record loadReactionsBy: ({ - by, - limit, - offset, - }: { + by, + limit, + offset, + }: { by: ReactionBy limit?: number offset?: number @@ -36,21 +36,21 @@ export const ReactionsProvider = (props: { children: JSX.Element }) => { const { showSnackbar } = useSnackbar() const loadReactionsBy = async ({ - by, - limit, - offset, - }: { + by, + limit, + offset, + }: { by: ReactionBy limit?: number offset?: number }): Promise => { const reactions = await apiClient.getReactionsBy({ by, limit, offset }) const newReactionEntities = reactions.reduce( - (acc: { [reaction_id: number]: Reaction }, reaction: Reaction) => { - acc[reaction.id] = reaction - return acc - }, - {}, + (acc: { [reaction_id: number]: Reaction }, reaction: Reaction) => { + acc[reaction.id] = reaction + return acc + }, + {}, ) setReactionEntities(newReactionEntities) return reactions @@ -66,14 +66,14 @@ export const ReactionsProvider = (props: { children: JSX.Element }) => { if ([ReactionKind.Like, ReactionKind.Dislike].includes(reaction.kind)) { const oppositeReactionKind = - reaction.kind === ReactionKind.Like ? ReactionKind.Dislike : ReactionKind.Like + reaction.kind === ReactionKind.Like ? ReactionKind.Dislike : ReactionKind.Like const oppositeReaction = Object.values(reactionEntities).find( - (r) => - r.kind === oppositeReactionKind && - r.created_by.slug === reaction.created_by.slug && - r.shout.id === reaction.shout.id && - r.reply_to === reaction.reply_to, + (r) => + r.kind === oppositeReactionKind && + r.created_by.slug === reaction.created_by.slug && + r.shout.id === reaction.shout.id && + r.reply_to === reaction.reply_to, ) if (oppositeReaction) {