Blogging platform with advanced tools for arts and sciences.
6

Configure Feed

Select the types of activity you want to include in your feed.

Docs

lemma (Jun 6, 2026, 10:46 AM -0500) 7c1b3252 0c5d0af4

+22
+22
docs/architecture.md
··· 131 131 132 132 This only covers the signed-in user's own data. If subscribed authors have not yet been indexed, fan-in finds no posts. Running the backfill Lambda with both the reader's and the author's DIDs resolves this. 133 133 134 + ## Subscriptions page 135 + 136 + The `/subscriptions` route (`app/routes/subscriptions.tsx`) lets a signed-in reader view and manage all publication subscriptions in one place. 137 + 138 + ### Data flow 139 + 140 + Subscription records (`Subscription[]`) are loaded once per session by `DataProvider` (`app/lib/data-context.tsx`) via `GET /subscriptions` and stored in React context. The subscriptions page reads those records directly from context — it never calls the API itself for the subscription list. 141 + 142 + Publication details (name, site URL, description) are **not** stored in context because resolving them requires a separate `GET /publications?did=<authorDid>` call per author. Instead, the page resolves them lazily in pages as the reader scrolls. 143 + 144 + ### Infinite scroll 145 + 146 + The page loads publication details for 20 subscriptions at a time: 147 + 148 + 1. The initial `useEffect` fires once when `subscriptions` first becomes defined in context (`initializedRef` prevents re-triggering on subsequent context updates from unsubscribes). 149 + 2. For each page slice, subscriptions are grouped by `authorDid` and `listPublicPublications` is called for each unique author — at most 5 concurrent requests at a time (`BATCH = 5`) using `Promise.allSettled`. Failed author lookups are silently dropped; the rest are rendered. 150 + 3. An `IntersectionObserver` on a sentinel `<div>` at the bottom of the list triggers the next page fetch when it scrolls into view. The observer captures `offset` and `subscriptions` at setup time so stale closure values are avoided. 151 + 152 + ### Unsubscribe 153 + 154 + Clicking "Subscribed" on a card calls `DELETE /subscriptions/:rkey` on the API and then calls `removeSubscription(rkey)` on the context, which filters the record out of the shared `subscriptions` array. The card is also removed from the local `pubs` state. The `initializedRef` guard ensures the removed subscription does not re-trigger the initial fetch loop. 155 + 134 156 ## Jetstream indexer 135 157 136 158 ### What it does