recent-data

lobehub/lobe-chat · updated Apr 8, 2026

$npx skills add https://github.com/lobehub/lobe-chat --skill recent-data
0 commentsdiscussion
summary

Recent data (recentTopics, recentResources, recentPages) is stored in session store.

skill.md

Recent Data Usage Guide

Recent data (recentTopics, recentResources, recentPages) is stored in session store.

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

Method 1: Read from Store (Recommended)

import { useSessionStore } from '@/store/session';
import { recentSelectors } from '@/store/session/selectors';

const Component = () => {
  const recentTopics = useSessionStore(recentSelectors.recentTopics);
  const isInit = useSessionStore(recentSelectors.isRecentTopicsInit);

  if (!isInit) return <div>Loading...</div>;

  return (
    <div>
      {recentTopics.map((topic) => (
        <div key={topic.id}>{topic.title}</div>
      ))}
    </div>
  );
};

Method 2: Use Hook Return (Single component)

const { data: recentTopics, isLoading } = useInitRecentTopic();

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);

Features

  1. Auto login detection: Only loads when user is logged in
  2. Data caching: Stored in store, no repeated loading
  3. Auto refresh: SWR refreshes on focus (5-minute interval)
  4. Type safe: Full TypeScript types

Best Practices

  1. Initialize all recent data at app top-level
  2. Use selectors to read from store
  3. For multi-component use, prefer Method 1
  4. Use selectors for render optimization

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.848 reviews
  • Hassan Li· Dec 28, 2024

    Registry listing for recent-data matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Dhruvi Jain· Dec 20, 2024

    recent-data is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Charlotte Li· Dec 4, 2024

    Useful defaults in recent-data — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • William Shah· Dec 4, 2024

    recent-data is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Jin Sharma· Nov 23, 2024

    I recommend recent-data for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Henry Yang· Nov 23, 2024

    recent-data has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Hana Nasser· Nov 23, 2024

    Keeps context tight: recent-data is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Hana Sethi· Nov 19, 2024

    Solid pick for teams standardizing on skills: recent-data is focused, and the summary matches what you get after install.

  • Oshnikdeep· Nov 11, 2024

    Keeps context tight: recent-data is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Jin Kapoor· Oct 14, 2024

    recent-data reduced setup friction for our internal harness; good balance of opinion and flexibility.

showing 1-10 of 48

1 / 5