@@ -33,17 +33,18 @@ import {
3333} from "@phosphor-icons/react" ;
3434import { ClockIcon , LightningBoltIcon } from "@radix-ui/react-icons" ;
3535import { AnimatePresence , motion } from "framer-motion" ;
36- import { ReactNode , useEffect , useMemo , useRef , useState } from "react" ;
36+ import { ReactNode , useEffect , useRef , useState } from "react" ;
3737import { useHotkeys } from "react-hotkeys-hook" ;
3838
3939import { AnimatedNumberBadge } from "../components/AnimatedNumberBadge" ;
4040import { SavedTab } from "../models" ;
41- import { bookmarkStoreActions , useBookmarkStore } from "../store/bookmarkStore" ;
41+ import { bookmarkStoreActions } from "../store/bookmarkStore" ;
4242import {
4343 curateStoreActions ,
4444 InclusionReason ,
4545 InclusionResult ,
4646 useCurateStore ,
47+ useCurateTabsById ,
4748} from "../store/curateStore" ;
4849import { pluralize } from "../util" ;
4950import { getUtcISO } from "../util/date" ;
@@ -54,6 +55,7 @@ import CurateSummary from "./CurateSummary";
5455import Ruler from "./Ruler" ;
5556import SwipeableCard , { Direction , SwipeableRef } from "./SwipeableCard" ;
5657import TagList from "./TagList" ;
58+ import { useIsMounted } from "usehooks-ts" ;
5759
5860interface Props {
5961 children ?: ReactNode ;
@@ -131,20 +133,13 @@ export function CurateTrigger({ children }: { children: ReactNode }) {
131133export default function Curate ( { children, maxCards = 5 , curateQueueItems } : Props ) {
132134 const open = useCurateStore ( ( s ) => s . open ) ;
133135 const settings = useCurateStore ( ( s ) => s . settings ) ;
134- const tabs = useBookmarkStore ( ( s ) => s . tabs ) ;
135136
136137 const { initialized, total, visibleQueue : queue , allQueue, kept, deleted, left, dequeue, unshift } = useCurateQueue (
137138 maxCards ,
138139 curateQueueItems ,
139140 ) ;
140141
141- const curateTabsById = useMemo ( ( ) => {
142- const curateTabIds = new Set ( curateQueueItems . map ( ( result ) => result . tabId ) ) ;
143-
144- return Object . fromEntries (
145- tabs . filter ( ( tab ) => curateTabIds . has ( tab . id ) ) . map ( ( tab ) => [ tab . id , tab ] ) ,
146- ) ;
147- } , [ tabs , curateQueueItems ] ) ;
142+ const curateTabsById = useCurateTabsById ( curateQueueItems ) ;
148143
149144 const swipeableRef = useRef < SwipeableRef | null > ( null ) ;
150145
@@ -306,6 +301,7 @@ export default function Curate({ children, maxCards = 5, curateQueueItems }: Pro
306301 constrained
307302 className = { cn (
308303 "focus-ring absolute rounded-2xl perspective-dramatic transform-3d" ,
304+ { 'will-change-auto' : i < 3 }
309305 ) }
310306 style = { {
311307 zIndex : remap ( i , 0 , maxCards , maxCards , 0 ) ,
0 commit comments