Skip to content

Commit

Permalink
feat: slim
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfulyang authored and powerfulyang committed Nov 2, 2023
1 parent 29053fa commit 7e413f3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/components/NavBar/index.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -52,7 +52,7 @@ export const NavBar = memo<NavBarProps>(() => {
</Link>
</div>
<Menus />
<D.DocSearch
<DocSearch
appId="A86PBLLW9T"
apiKey="feb9259815bc0476dbbf018ef7fb25c6"
indexName="powerfulyang"
Expand Down
6 changes: 1 addition & 5 deletions src/components/Timeline/TimelineForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
removeFromFileList,
sourceUrlToFile,
} from '@/utils/copy';
import { trpc } from '@/utils/trpc';
import { zodResolver } from '@hookform/resolvers/zod';
import { useImmer, useIsomorphicLayoutEffect } from '@powerfulyang/hooks';
import { useMutation } from '@tanstack/react-query';
Expand Down Expand Up @@ -74,8 +73,6 @@ export const TimeLineForm = memo<Props>(({ onSubmitSuccess }) => {
}
}, [editItem, setValue]);

const cacheClean = trpc.cacheClean.useMutation();

const mutation = useMutation({
onMutate() {
confetti();
Expand All @@ -88,15 +85,14 @@ export const TimeLineForm = memo<Props>(({ onSubmitSuccess }) => {
const res_1 = await clientApi.createFeed(variables);
return res_1.data;
},
async onSuccess(data) {
onSuccess(data) {
reset();
if (editItem) {
onSubmitSuccess('modify', data);
setEditItem(undefined);
} else {
onSubmitSuccess('create', data);
}
await cacheClean.mutateAsync();
},
});

Expand Down
3 changes: 1 addition & 2 deletions src/pages/timeline/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -72,7 +71,7 @@ export const Timeline: LayoutFC<TimelineProps> = ({ 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 (
<div className={styles.feeds}>
{res?.map((feed) => (
Expand Down

0 comments on commit 7e413f3

Please sign in to comment.