Browse Source

bug-fixes

imwald
Silberengel 3 weeks ago
parent
commit
c301dc86c3
  1. 5
      src/PageManager.tsx
  2. 8
      src/lib/nip05.ts
  3. 1
      src/services/client-query.service.ts

5
src/PageManager.tsx

@ -129,7 +129,6 @@ const PrimaryProfileBadgesListPageLazy = lazy(() => import('@/pages/secondary/Pr @@ -129,7 +129,6 @@ const PrimaryProfileBadgesListPageLazy = lazy(() => import('@/pages/secondary/Pr
const PrimaryInterestListPageLazy = lazy(() => import('@/pages/secondary/InterestListPage'))
const PrimaryUserEmojiListPageLazy = lazy(() => import('@/pages/secondary/UserEmojiListPage'))
const PrimaryOthersRelaySettingsPageLazy = lazy(() => import('@/pages/secondary/OthersRelaySettingsPage'))
const SecondaryRelayPageLazy = lazy(() => import('@/pages/secondary/RelayPage'))
function suspensePrimaryPage(page: ReactElement) {
return <Suspense fallback={primaryPageLazyFallback}>{page}</Suspense>
@ -588,9 +587,7 @@ export function useSmartNoteNavigationOptional() { @@ -588,9 +587,7 @@ export function useSmartNoteNavigationOptional() {
// Fixed: Relay navigation now uses primary note view on mobile, secondary routing (drawer in single-pane, side panel in double-pane) on desktop
export function useSmartRelayNavigation() {
const { setPrimaryNoteView } = usePrimaryNoteView()
const { push: pushSecondaryPage } = useSecondaryPage()
const { isSmallScreen } = useScreenSize()
const { current: currentPrimaryPage } = usePrimaryPage()
const navigateToRelay = (url: string) => {
@ -620,9 +617,7 @@ export function useSmartRelayNavigationOptional() { @@ -620,9 +617,7 @@ export function useSmartRelayNavigationOptional() {
if (!primaryNoteView || !secondaryPage || !screenSize || !primaryPage) {
return { navigateToRelay: (url: string) => { window.location.href = url } }
}
const { setPrimaryNoteView } = primaryNoteView
const { push: pushSecondaryPage } = secondaryPage
const { isSmallScreen } = screenSize
const { current: currentPrimaryPage } = primaryPage
const navigateToRelay = (url: string) => {
const relayUrlMatch =

8
src/lib/nip05.ts

@ -20,8 +20,10 @@ type TVerifyNip05Result = { @@ -20,8 +20,10 @@ type TVerifyNip05Result = {
/** Bumps when verification rules change so LRU does not serve stale false negatives. */
const VERIFY_CACHE_SCHEMA = 4
type WellKnownCacheEntry = { json: Record<string, unknown> | null }
/** Per-domain `nostr.json` (or negative `null`) so feeds do not re-fetch every NIP-05 on the same host. */
const wellKnownJsonByDomain = new LRUCache<string, Record<string, unknown> | null>({ max: 512 })
const wellKnownJsonByDomain = new LRUCache<string, WellKnownCacheEntry>({ max: 512 })
const wellKnownDomainInFlight = new Map<string, Promise<Record<string, unknown> | null>>()
function normalizeNip05Domain(domain: string): string {
@ -252,12 +254,12 @@ async function getOrFetchWellKnownJsonForDomain( @@ -252,12 +254,12 @@ async function getOrFetchWellKnownJsonForDomain(
const key = normalizeNip05Domain(domain)
if (!key) return null
if (wellKnownJsonByDomain.has(key)) {
return wellKnownJsonByDomain.get(key) ?? null
return wellKnownJsonByDomain.get(key)!.json
}
let inflight = wellKnownDomainInFlight.get(key)
if (!inflight) {
inflight = fetchWellKnownNostrJsonNetwork(key, nameHint).then((json) => {
wellKnownJsonByDomain.set(key, json)
wellKnownJsonByDomain.set(key, { json })
wellKnownDomainInFlight.delete(key)
return json
})

1
src/services/client-query.service.ts

@ -1,5 +1,4 @@ @@ -1,5 +1,4 @@
import {
FAST_READ_RELAY_URLS,
FEED_FIRST_RELAY_RESULT_GRACE_MIN_LIMIT,
FIRST_RELAY_RESULT_GRACE_MS,
relayFilterIncludesSocialKindBlockedKind,

Loading…
Cancel
Save