summaryrefslogtreecommitdiff
path: root/front/src/components/feed/PostList.tsx
blob: 3d41ff85f39ee87c287a1ac0f0fbbd1f4f35df9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import TrillPost from "./Post";
import type { FC } from "@/types/trill";
// import { useEffect } from "react";
// import { useQueryClient } from "@tanstack/react-query";
// import { toFull } from "../thread/helpers";

function TrillFeed({ data, refetch }: { data: FC; refetch: Function }) {
  // const qc = useQueryClient();
  // useEffect(() => {
  //   Object.values(data.feed).forEach((poast) => {
  //     const queryKey = ["trill-thread", poast.host, poast.id];
  //     const existing = qc.getQueryData(queryKey);
  //     if (!existing || !("fpost" in (existing as any))) {
  //       qc.setQueryData(queryKey, {
  //         fpost: toFull(poast),
  //       });
  //     }
  //   });
  // }, [data]);
  return (
    <>
      {Object.keys(data.feed)
        .sort()
        .reverse()
        .map((i) => (
          <TrillPost key={i} poast={data.feed[i]} refetch={refetch} />
        ))}
    </>
  );
}

export default TrillFeed;