chore(client): remove dev-seed for chats + feed
Two dev-only seed modules removed now that the app talks to a real
backend:
- lib/devSeed.ts — fake 15+ contacts with mock chat histories,
mounted via useDevSeed() in (app)/_layout.tsx on empty store.
Was useful during client-first development; now it fights real
contact sync and confuses operators bringing up fresh nodes
("why do I see NBA scores and a dchain_updates channel in my
chat list?").
- lib/devSeedFeed.ts — 12 synthetic feed posts surfaced when the
real API returned empty. Same reasoning: operator imports genesis
key on a fresh node, opens Feed, sees 12 mock posts that aren't on
their chain. "Test data" that looks real is worse than an honest
empty state.
Feed screen now shows its proper empty state ("Пока нет
рекомендаций", etc.) when the API returns zero items OR on network
error. Chat screen starts empty until real contacts + messages
arrive via WS / storage cache.
Also cleaned a stale comment in chats/[id].tsx that referenced
devSeed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,7 +23,6 @@ import { useWellKnownContracts } from '@/hooks/useWellKnownContracts';
|
||||
import { useNotifications } from '@/hooks/useNotifications';
|
||||
import { useGlobalInbox } from '@/hooks/useGlobalInbox';
|
||||
import { getWSClient } from '@/lib/ws';
|
||||
import { useDevSeed } from '@/lib/devSeed';
|
||||
import { NavBar } from '@/components/NavBar';
|
||||
import { AnimatedSlot } from '@/components/AnimatedSlot';
|
||||
|
||||
@@ -45,7 +44,6 @@ export default function AppLayout() {
|
||||
useBalance();
|
||||
useContacts();
|
||||
useWellKnownContracts();
|
||||
useDevSeed();
|
||||
useNotifications(); // permission + tap-handler
|
||||
useGlobalInbox(); // global inbox listener → notifications on new peer msg
|
||||
|
||||
|
||||
@@ -121,9 +121,9 @@ export default function ChatScreen() {
|
||||
// Восстановить сообщения из persistent-storage при первом заходе в чат.
|
||||
//
|
||||
// Важно: НЕ перезаписываем store пустым массивом — это стёрло бы
|
||||
// содержимое, которое уже лежит в zustand (например, из devSeed или
|
||||
// только что полученные по WS сообщения пока монтировались). Если
|
||||
// в кэше что-то есть — мержим: берём max(cached, in-store) по id.
|
||||
// содержимое, которое уже лежит в zustand (только что полученные по
|
||||
// WS сообщения пока монтировались). Если в кэше что-то есть — мержим:
|
||||
// берём max(cached, in-store) по id.
|
||||
useEffect(() => {
|
||||
if (!contactAddress) return;
|
||||
loadMessages(contactAddress).then(cached => {
|
||||
|
||||
@@ -27,7 +27,6 @@ import {
|
||||
fetchTimeline, fetchForYou, fetchTrending, fetchStats, bumpView,
|
||||
type FeedPostItem,
|
||||
} from '@/lib/feed';
|
||||
import { getDevSeedFeed } from '@/lib/devSeedFeed';
|
||||
|
||||
type TabKey = 'following' | 'foryou' | 'trending';
|
||||
|
||||
@@ -78,12 +77,6 @@ export default function FeedScreen() {
|
||||
}
|
||||
if (seq !== requestRef.current) return; // stale response
|
||||
|
||||
// Dev-only fallback: if the node has no real posts yet, surface
|
||||
// synthetic ones so we can scroll + tap. Stripped from production.
|
||||
if (items.length === 0) {
|
||||
items = getDevSeedFeed();
|
||||
}
|
||||
|
||||
setPosts(items);
|
||||
// If the server returned fewer than PAGE_SIZE, we already have
|
||||
// everything — disable further paginated fetches.
|
||||
@@ -105,11 +98,11 @@ export default function FeedScreen() {
|
||||
} catch (e: any) {
|
||||
if (seq !== requestRef.current) return;
|
||||
const msg = String(e?.message ?? e);
|
||||
// Network / 404 is benign — node just unreachable or empty. In __DEV__
|
||||
// fall back to synthetic seed posts so the scroll / tap UI stays
|
||||
// testable; in production this path shows the empty state.
|
||||
// Network / 404 is benign — node just unreachable or empty. Show
|
||||
// the empty-state; the catch block above already cleared error
|
||||
// on benign messages. Production treats this identically.
|
||||
if (/Network request failed|→\s*404/.test(msg)) {
|
||||
setPosts(getDevSeedFeed());
|
||||
setPosts([]);
|
||||
setExhausted(true);
|
||||
} else {
|
||||
setError(msg);
|
||||
|
||||
Reference in New Issue
Block a user