- Add SWR package and global SWRProvider - Create reusable hooks: useTools, useAgents, useCollections, useStats, useLikeStatus, useBundleSize, useActivity - Update tool-search page to use useTools hook - Update agents page to use useAgents hook - Update BundleSize component to use useBundleSize hook - Update LikeButton with optimistic updates via useLikeStatus - Add simple about page with creator info
23 lines
451 B
TypeScript
23 lines
451 B
TypeScript
'use client';
|
|
|
|
import type { ReactNode } from 'react';
|
|
import { SWRConfig } from 'swr';
|
|
import { fetcher } from '~/lib/swr/fetcher';
|
|
|
|
interface SWRProviderProps {
|
|
children: ReactNode;
|
|
}
|
|
|
|
export function SWRProvider({ children }: SWRProviderProps): React.ReactElement {
|
|
return (
|
|
<SWRConfig
|
|
value={{
|
|
fetcher,
|
|
revalidateOnFocus: false,
|
|
dedupingInterval: 5000,
|
|
}}
|
|
>
|
|
{children}
|
|
</SWRConfig>
|
|
);
|
|
}
|