supermemory/apps/memory-graph-playground
Abhijeet Sharma 8d3f7ac8d6 fix(docs): correct stale @supermemory/memory-graph API references
apps/docs/integrations/memory-graph.mdx and apps/memory-graph-playground/README.md
documented an older version of the @supermemory/memory-graph public API. Following
the Quick Start, Props Reference, or Exports section as written produced code that
either fails to type-check or silently drops props the component no longer has.

Verified against packages/memory-graph/src/{index.tsx,types.ts,api-types.ts,mock-data.ts,
constants.ts} and cross-checked the API normalization logic against two independent
real call sites: apps/web/components/memory-graph/hooks/use-graph-api.ts and
apps/memory-graph-playground/src/app/page.tsx.

- Exports section listed Legend, NodeDetailPanel, SpacesDropdown, useGraphInteractions,
  colors, LAYOUT_CONSTANTS - none of these are actually exported. Corrected to the
  real exports and added the previously-undocumented ./mock-data subpath.
- All examples used loadMoreDocuments/totalLoaded/selectedSpace/onSpaceChange/
  showSpacesSelector, none of which exist on MemoryGraphProps. Corrected to
  onLoadMore/totalCount and removed the Controlled Space Selection example
  (that feature no longer exists on the component).
- documents was typed as DocumentWithMemories[] with a fabricated shape; the real
  prop type is GraphApiDocument[]. Added a toGraphDocument mapping example grounded
  in the real production code that talks to /v3/documents/documents.
- Rewrote Props Reference and Data Types to match the real MemoryGraphProps and
  GraphApiDocument/GraphApiMemory interfaces field-for-field, including several
  real props that weren't documented at all before.
- Removed the false 'space selector visible/hidden' claim from the Variants section
  (no such component exists anywhere in packages/memory-graph/src); kept the 0.8x/0.5x
  zoom figures, which checked out against constants.ts.
- Made the Pages Router and Express tabs in Backend API Route self-contained (each
  defines its own toGraphDocument mapping) instead of depending on code shown only
  in the App Router tab, since CodeGroup tabs are alternatives a reader copies
  individually.
- Applied the identical corrections to apps/memory-graph-playground/README.md,
  which had the same drift independently.

Address Graphite automated review feedback:
- Set the content field in all three toGraphDocument mappings (was a valid but
  unpopulated field on GraphApiMemory). Confirmed via use-graph-data.ts that it's
  inert for rendering (always overwritten with mem.memory before draw), so this
  wasn't visible data loss, but it's a free fix that matches the type exactly.
- Replaced the (data.documents as RawDocument[]) cast with a proper
  RawDocumentsResponse type annotation on data in the App Router and Pages Router
  tabs, per the custom TypeScript style rule Graphite flagged. Implemented what
  the comment's prose described rather than its literal suggested diff, which
  would have just deleted the cast and left data as any.

Docs-only change, no .ts/.tsx files touched. This repo's biome.json has no
Markdown/MDX support configured, so format-lint doesn't apply here; checked
fence and MDX-component balance by hand instead (34 fence lines, all CodeGroup/
Note/Warning/Card tags balanced 1:1).
2026-08-05 21:25:01 +05:30
..
public runtime styles injection + let user proxy requests for data in graph package + new playground (#588) 2025-11-22 07:04:05 +00:00
src/app Improve memory graph (#973) 2026-06-05 15:48:41 -07:00
.gitignore runtime styles injection + let user proxy requests for data in graph package + new playground (#588) 2025-11-22 07:04:05 +00:00
next-env.d.ts Rewrite @supermemory/memory-graph with perf optimizations + consolidate consumers (#809) 2026-03-28 19:06:27 -07:00
next.config.ts add spaces selector with search (#600) 2025-12-02 18:37:24 +00:00
package.json fix(deps): bump next to 16.0.7 in memory-graph-playground (critical CVE) (#1082) 2026-06-16 21:10:32 -07:00
postcss.config.mjs add spaces selector with search (#600) 2025-12-02 18:37:24 +00:00
README.md fix(docs): correct stale @supermemory/memory-graph API references 2026-08-05 21:25:01 +05:30
tsconfig.json add spaces selector with search (#600) 2025-12-02 18:37:24 +00:00

Memory Graph Playground

A demo app showcasing the @supermemory/memory-graph package.

Getting Started

bun install
bun dev

Open http://localhost:3000 and enter your Supermemory API key.

Usage Example

import { MemoryGraph, type GraphApiDocument } from '@supermemory/memory-graph'

function App() {
  const [documents, setDocuments] = useState<GraphApiDocument[]>([])

  return (
    <MemoryGraph
      documents={documents}
      isLoading={false}
      isLoadingMore={false}
      error={null}
      hasMore={false}
      onLoadMore={() => {}}
      totalCount={documents.length}
      variant="console"
    >
      <div>No memories found</div>
    </MemoryGraph>
  )
}

See src/app/page.tsx for the full working example, including converting a raw API response into GraphApiDocument[].

Props

Prop Type Description
documents GraphApiDocument[] Array of documents to display
isLoading boolean Initial loading state
isLoadingMore boolean Loading more documents state
error Error | null Error to display
hasMore boolean Whether more documents can be loaded
onLoadMore () => void Callback to load more documents
totalCount number Total number of loaded documents
variant "console" | "consumer" Visual variant

See packages/memory-graph for the full MemoryGraphProps reference.