Basic information
About recent-data
Guide for using Recent Data (topics, resources, pages). Use when working with recently accessed items, implementing recent lists, or accessing session store recent data. Triggers on recent data usage or implementation tasks.
recent-data is an agent skill listed in the AddMCP.net directory, published by lobehub. Runtime: TypeScript. The repository has 83,522 GitHub stars. Source code is hosted on github.com. Related topics: agent, agent-collaboration, agent-harness, ai, cao.
Overview
What is recent-data?
name: recent-data description: Guide for using Recent Data (topics, resources, pages). Use when working with recently accessed items, implementing recent lists, or accessing session store recent data. Triggers on recent data usage or implementation tasks. user-invocable: false
Recent Data Usage Guide
Recent data (recentTopics, recentResources, recentPages) is stored in session store.
What it does
- Auto login detection: Only loads when user is logged in
- Data caching: Stored in store, no repeated loading
- Auto refresh: SWR refreshes on focus (5-minute interval)
- Type safe: Full TypeScript types
Initialization
In app top-level (e.g., RecentHydration.tsx):
import { useInitRecentTopic } from '@/hooks/useInitRecentTopic';
import { useInitRecentResource } from '@/hooks/useInitRecentResource';
import { useInitRecentPage } from '@/hooks/useInitRecentPage';
const App = () => {
useInitRecentTopic();
useInitRecentResource();
useInitRecentPage();
return <YourComponents />;
};Usage
Available Selectors
Recent Topics
const recentTopics = useSessionStore(recentSelectors.recentTopics);
// Type: RecentTopic[]
const isInit = useSessionStore(recentSelectors.isRecentTopicsInit);
// Type: boolean
RecentTopic type:
interface RecentTopic {
agent: {
avatar: string | null;
backgroundColor: string | null;
id: string;
title: string | null;
} | null;
id: string;
title: string | null;
updatedAt: Date;
}
Recent Resources
const recentResources = useSessionStore(recentSelectors.recentResources);
// Type: FileListItem[]
const isInit = useSessionStore(recentSelectors.isRecentResourcesInit);
Recent Pages
const recentPages = useSessionStore(recentSelectors.recentPages);
const isInit = useSessionStore(recentSelectors.isRecentPagesInit);Best Practices
- Initialize all recent data at app top-level
- Use selectors to read from store
- For multi-component use, prefer Method 1
- Use selectors for render optimization
Comments
No comments yet
Be the first to share feedback about this listing. Sign in to leave a comment.
Sign In