Skip to content

Add content preview snippets to workspace home page list #1454

Description

@sw-factory-automations

Description

The workspace home page list shows only page titles, icons, and last-modified timestamps. When multiple pages share the same title (especially "Untitled"), users cannot distinguish between them without clicking each one. Adding a single-line content preview snippet below each page title would help users identify pages at a glance, similar to how email clients show message previews.

Evidence

  • Live product review: The workspace home showed 19 pages, many titled "Untitled" or "Untitled Database". Without content previews, these pages are visually indistinguishable. Users must click each page to find the one they want.
  • Codebase review: The pages table stores content as Lexical JSON (content jsonb). A public.extract_text_from_lexical(content) function already exists in the database (migration 20260415111351) for search indexing. The workspace home query (src/app/(app)/[workspaceSlug]/page.tsx) currently fetches id, title, parent_id, position, icon, is_database, created_at, updated_at — no content data.
  • User feedback: Multiple feedback digests note low search usage relative to page views, suggesting users browse rather than search — content previews would make browsing more effective.

Acceptance Criteria

  • Each page row in the workspace home "All Pages" list shows a single-line content preview below the title
  • Preview is truncated to ~80 characters with ellipsis
  • Preview text uses text-xs text-muted-foreground styling
  • Database pages show "Database · N rows" instead of content preview
  • Pages with no content show no preview line (no empty space)
  • Recently Visited section also shows content previews
  • pnpm lint && pnpm typecheck && pnpm test pass

Technical Notes

  • Option A (recommended): Add a stored content_preview column to the pages table, maintained by a trigger that calls extract_text_from_lexical() and truncates to 200 chars on INSERT/UPDATE. This avoids fetching full content JSON for all pages.
  • Option B: Compute previews client-side by fetching content for visible pages. This is expensive for large workspaces and not recommended.
  • Migration: npx supabase migration new add_content_preview_column
  • Update the workspace home query to include content_preview in the SELECT
  • Update WorkspaceHomeProps type and the page list rendering in src/components/workspace-home.tsx
  • The extract_text_from_lexical function already handles Lexical JSON tree walking — reuse it in the trigger

Approval Required

This improvement was flagged as high-risk because it requires a database schema change (new column + trigger on the pages table) and modifies the data model. To approve, comment "approved" and the automation will pick it up. To reject, close the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-humanNeeds human input — automation will re-queue when user respondspriority:3

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions