Browse Source

bug-fix

imwald
Silberengel 1 month ago
parent
commit
d407a65460
  1. 4
      package-lock.json
  2. 2
      package.json
  3. 2
      src/components/Explore/ExploreRelayReviews.tsx
  4. 21
      src/pages/primary/SpellsPage/fauxSpellFeeds.ts
  5. 10
      src/pages/primary/SpellsPage/index.tsx

4
package-lock.json generated

@ -1,12 +1,12 @@
{ {
"name": "jumble-imwald", "name": "jumble-imwald",
"version": "19.2.0", "version": "19.2.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "jumble-imwald", "name": "jumble-imwald",
"version": "19.2.0", "version": "19.2.1",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@asciidoctor/core": "^3.0.4", "@asciidoctor/core": "^3.0.4",

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "jumble-imwald", "name": "jumble-imwald",
"version": "19.2.0", "version": "19.2.1",
"description": "A user-friendly Nostr client focused on relay feed browsing and relay discovery, forked from Jumble", "description": "A user-friendly Nostr client focused on relay feed browsing and relay discovery, forked from Jumble",
"private": true, "private": true,
"type": "module", "type": "module",

2
src/components/Explore/ExploreRelayReviews.tsx

@ -14,7 +14,7 @@ import { useTranslation } from 'react-i18next'
const REVIEW_QUERY_LIMIT = 100 const REVIEW_QUERY_LIMIT = 100
const SHOW_COUNT = 20 const SHOW_COUNT = 20
/** Fewer sockets + faster aggregate EOSE than full inbox stack; read-only mirrors still appended then capped. */ /** Fewer sockets + faster aggregate EOSE than full inbox stack; read-only mirrors prepended then capped. */
const EXPLORE_REVIEWS_MAX_RELAYS = 12 const EXPLORE_REVIEWS_MAX_RELAYS = 12
/** After all relays EOSE, wait longer than default so slow mirrors can flush events (default query eose is 500ms). */ /** After all relays EOSE, wait longer than default so slow mirrors can flush events (default query eose is 500ms). */
const EXPLORE_REVIEWS_EOSE_TAIL_MS = 4500 const EXPLORE_REVIEWS_EOSE_TAIL_MS = 4500

21
src/pages/primary/SpellsPage/fauxSpellFeeds.ts

@ -4,9 +4,10 @@
* waiting for every relay to EOSE on a one-shot query. * waiting for every relay to EOSE on a one-shot query.
* *
* **Why faux feeds can feel slow:** each timeline shard opens live REQs over the prioritized relay * **Why faux feeds can feel slow:** each timeline shard opens live REQs over the prioritized relay
* stack (see {@link applyFauxSpellCapsToSubRequests}). The **interests** spell uses **one** shard: all subscribed * stack (see {@link applyFauxSpellCapsToSubRequests}). Read-only mirrors are **prepended** in
* topics go in a single `#t` filter (NIP-01 OR semantics). The notifications spell uses a narrow * {@link appendCuratedReadOnlyRelays} so the per-shard relay cap still includes aggregators (otherwise
* kind list vs full profile kinds. * inbox+favorites fill the cap and global kinds/media/hashtags never hit aggr). The **interests** spell
* uses **one** shard: all subscribed topics in one `#t` filter (NIP-01 OR semantics).
*/ */
import { ExtendedKind, PROFILE_FEED_KINDS, READ_ONLY_RELAY_URLS } from '@/constants' import { ExtendedKind, PROFILE_FEED_KINDS, READ_ONLY_RELAY_URLS } from '@/constants'
import { buildProfileAugmentedReadRelayUrls } from '@/lib/favorites-feed-relays' import { buildProfileAugmentedReadRelayUrls } from '@/lib/favorites-feed-relays'
@ -17,7 +18,7 @@ import type { TFeedSubRequest } from '@/types'
import { type Event, type Filter, kinds } from 'nostr-tools' import { type Event, type Filter, kinds } from 'nostr-tools'
/** Default caps for every faux spell feed (relays per subrequest, events per REQ). */ /** Default caps for every faux spell feed (relays per subrequest, events per REQ). */
export const FAUX_SPELL_MAX_RELAYS = 6 export const FAUX_SPELL_MAX_RELAYS = 10
export const FAUX_SPELL_EVENT_LIMIT = 200 export const FAUX_SPELL_EVENT_LIMIT = 200
/** Profile Media tab: single REQ `limit` (matches merged cap in NoteList one-shot). */ /** Profile Media tab: single REQ `limit` (matches merged cap in NoteList one-shot). */
@ -68,21 +69,23 @@ export const NOTIFICATION_SPELL_KINDS = [
const INTERESTS_MAX_TOPICS = 80 const INTERESTS_MAX_TOPICS = 80
/** /**
* Append {@link READ_ONLY_RELAY_URLS} (e.g. aggr) after the curated set so every faux REQ includes them unless blocked. * Put {@link READ_ONLY_RELAY_URLS} (e.g. aggr) **first**, then curated relays. Faux spells cap URL count
* ({@link FAUX_SPELL_MAX_RELAYS}); appending read-only at the end dropped mirrors whenever inbox+favorites
* filled the cap.
*/ */
export function appendCuratedReadOnlyRelays(curated: string[], blockedRelays: string[]): string[] { export function appendCuratedReadOnlyRelays(curated: string[], blockedRelays: string[]): string[] {
const blocked = new Set(blockedRelays.map((b) => normalizeUrl(b) || b)) const blocked = new Set(blockedRelays.map((b) => normalizeUrl(b) || b))
const seen = new Set<string>() const seen = new Set<string>()
const out: string[] = [] const out: string[] = []
for (const u of curated) { for (const u of READ_ONLY_RELAY_URLS) {
const k = normalizeUrl(u) || u const k = normalizeUrl(u) || u
if (!k || seen.has(k)) continue if (!k || blocked.has(k) || seen.has(k)) continue
seen.add(k) seen.add(k)
out.push(k) out.push(k)
} }
for (const u of READ_ONLY_RELAY_URLS) { for (const u of curated) {
const k = normalizeUrl(u) || u const k = normalizeUrl(u) || u
if (!k || blocked.has(k) || seen.has(k)) continue if (!k || seen.has(k)) continue
seen.add(k) seen.add(k)
out.push(k) out.push(k)
} }

10
src/pages/primary/SpellsPage/index.tsx

@ -657,10 +657,14 @@ const SpellsPage = forwardRef<TPageRef>(function SpellsPage(
const syncFauxSubRequests = useMemo<TFeedSubRequest[]>(() => { const syncFauxSubRequests = useMemo<TFeedSubRequest[]>(() => {
if (!selectedFauxSpell || selectedFauxSpell === 'following') return [] if (!selectedFauxSpell || selectedFauxSpell === 'following') return []
/** Widen relay pool: these filters are not kind-1-only; skipping strip keeps fast-read mirrors in the stack. */
const fauxSpellSkipKind1Blocked = const fauxSpellSkipKind1Blocked =
selectedFauxSpell === 'calendar' || selectedFauxSpell === 'calendar' ||
selectedFauxSpell === 'discussions' || selectedFauxSpell === 'discussions' ||
selectedFauxSpell === 'followPacks' selectedFauxSpell === 'followPacks' ||
selectedFauxSpell === 'media' ||
selectedFauxSpell === 'bookmarks' ||
selectedFauxSpell === 'interests'
const feedUrls = getRelayUrlsWithFavoritesFastReadAndInbox( const feedUrls = getRelayUrlsWithFavoritesFastReadAndInbox(
favoriteRelays, favoriteRelays,
blockedRelays, blockedRelays,
@ -676,9 +680,7 @@ const SpellsPage = forwardRef<TPageRef>(function SpellsPage(
return [{ urls: feedUrls, filter: buildMentionsSpellFilter(pubkey) }] return [{ urls: feedUrls, filter: buildMentionsSpellFilter(pubkey) }]
} }
if (selectedFauxSpell === 'discussions') { if (selectedFauxSpell === 'discussions') {
// Same as followPacks: prioritized stack is capped (MAX_REQ_RELAY_URLS); tier-4 FAST_READ // Read-only prepended in appendCuratedReadOnlyRelays so FAUX_SPELL_MAX_RELAYS still includes aggr.
// (incl. aggr) is often dropped when inbox + favorites fill the cap. Append read-only aggr so
// kind-11 discussions still resolve; also recover when feedUrls is empty (all blocked / no list).
const urls = appendCuratedReadOnlyRelays(feedUrls, blockedRelays) const urls = appendCuratedReadOnlyRelays(feedUrls, blockedRelays)
if (!urls.length) return [] if (!urls.length) return []
return [{ urls, filter: buildDiscussionFilter() }] return [{ urls, filter: buildDiscussionFilter() }]

Loading…
Cancel
Save