From 7e413f3aa75413550b6614d0ff2371db0bc67749 Mon Sep 17 00:00:00 2001 From: powerfulyang Date: Thu, 2 Nov 2023 20:43:41 +0800 Subject: [PATCH] feat: slim --- src/components/NavBar/index.tsx | 4 ++-- src/components/Timeline/TimelineForm/index.tsx | 6 +----- src/pages/timeline/index.tsx | 3 +-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/components/NavBar/index.tsx b/src/components/NavBar/index.tsx index 14c4d926..e8c42d82 100644 --- a/src/components/NavBar/index.tsx +++ b/src/components/NavBar/index.tsx @@ -1,7 +1,7 @@ 'use client'; import { ProjectName } from '@/constant/Constant'; -import * as D from '@docsearch/react'; +import { DocSearch } from '@docsearch/react'; import classNames from 'classnames'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; @@ -52,7 +52,7 @@ export const NavBar = memo(() => { - (({ onSubmitSuccess }) => { } }, [editItem, setValue]); - const cacheClean = trpc.cacheClean.useMutation(); - const mutation = useMutation({ onMutate() { confetti(); @@ -88,7 +85,7 @@ export const TimeLineForm = memo(({ onSubmitSuccess }) => { const res_1 = await clientApi.createFeed(variables); return res_1.data; }, - async onSuccess(data) { + onSuccess(data) { reset(); if (editItem) { onSubmitSuccess('modify', data); @@ -96,7 +93,6 @@ export const TimeLineForm = memo(({ onSubmitSuccess }) => { } else { onSubmitSuccess('create', data); } - await cacheClean.mutateAsync(); }, }); diff --git a/src/pages/timeline/index.tsx b/src/pages/timeline/index.tsx index 31f7977b..182514fb 100644 --- a/src/pages/timeline/index.tsx +++ b/src/pages/timeline/index.tsx @@ -2,7 +2,6 @@ import { firstItem, isEmpty, lastItem } from '@powerfulyang/utils'; import type { InfiniteData } from '@tanstack/react-query'; import { useInfiniteQuery, useQueryClient } from '@tanstack/react-query'; import { kv } from '@vercel/kv'; -import { flatten } from 'lodash-es'; import type { GetServerSideProps } from 'next'; import React, { Fragment, useMemo } from 'react'; import { InView } from 'react-intersection-observer'; @@ -72,7 +71,7 @@ export const Timeline: LayoutFC = ({ feeds, nextCursor, prevCurso const bannerUser = user || feeds[0]?.createBy; const resources = useMemo(() => { - const res = flatten(data?.pages.map((x) => x.resources) || []); + const res = (data?.pages.map((x) => x.resources) || []).flat(); return (
{res?.map((feed) => (