|
|
|
@ -67,7 +67,10 @@ export function FeedProvider({ children }: { children: ReactNode }) { |
|
|
|
[favoriteRelays, relaySets] |
|
|
|
[favoriteRelays, relaySets] |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
/** Home Notes/Gallery stay focused: favorites/defaults plus the mixed trending relay. */ |
|
|
|
/** |
|
|
|
|
|
|
|
* Mixed trending slice (nostrarchives / Wisp-style feed) so the home timeline isn’t only the user’s |
|
|
|
|
|
|
|
* graph — keeps a finger on what the wider network is surfacing, alongside favorites / NIP-65. |
|
|
|
|
|
|
|
*/ |
|
|
|
const primaryExtraRelayUrls = useMemo(() => [buildWispTrendingNotesRelayUrl()], []) |
|
|
|
const primaryExtraRelayUrls = useMemo(() => [buildWispTrendingNotesRelayUrl()], []) |
|
|
|
|
|
|
|
|
|
|
|
/** Home Replies widen to relays that can surface inbox/reply context. */ |
|
|
|
/** Home Replies widen to relays that can surface inbox/reply context. */ |
|
|
|
@ -182,6 +185,8 @@ export function FeedProvider({ children }: { children: ReactNode }) { |
|
|
|
) |
|
|
|
) |
|
|
|
const lastRelayInitDebugKey = useRef('') |
|
|
|
const lastRelayInitDebugKey = useRef('') |
|
|
|
const lastHadFavoriteRelaysRef = useRef<boolean | null>(null) |
|
|
|
const lastHadFavoriteRelaysRef = useRef<boolean | null>(null) |
|
|
|
|
|
|
|
const relayUrlDebounceTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null) |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
const initKey = [ |
|
|
|
const initKey = [ |
|
|
|
isInitialized ? '1' : '0', |
|
|
|
isInitialized ? '1' : '0', |
|
|
|
@ -194,6 +199,8 @@ export function FeedProvider({ children }: { children: ReactNode }) { |
|
|
|
replyExtraRelayLayers.httpRelayUrls.length, |
|
|
|
replyExtraRelayLayers.httpRelayUrls.length, |
|
|
|
blockedRelays.length |
|
|
|
blockedRelays.length |
|
|
|
].join('\x1e') |
|
|
|
].join('\x1e') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const flush = () => { |
|
|
|
if (initKey !== lastRelayInitDebugKey.current) { |
|
|
|
if (initKey !== lastRelayInitDebugKey.current) { |
|
|
|
lastRelayInitDebugKey.current = initKey |
|
|
|
lastRelayInitDebugKey.current = initKey |
|
|
|
logger.debug('FeedProvider relay init:', { |
|
|
|
logger.debug('FeedProvider relay init:', { |
|
|
|
@ -217,6 +224,22 @@ export function FeedProvider({ children }: { children: ReactNode }) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
updateFeedRelayUrls() |
|
|
|
updateFeedRelayUrls() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (relayUrlDebounceTimerRef.current) { |
|
|
|
|
|
|
|
clearTimeout(relayUrlDebounceTimerRef.current) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
relayUrlDebounceTimerRef.current = setTimeout(() => { |
|
|
|
|
|
|
|
relayUrlDebounceTimerRef.current = null |
|
|
|
|
|
|
|
flush() |
|
|
|
|
|
|
|
}, 80) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return () => { |
|
|
|
|
|
|
|
if (relayUrlDebounceTimerRef.current) { |
|
|
|
|
|
|
|
clearTimeout(relayUrlDebounceTimerRef.current) |
|
|
|
|
|
|
|
relayUrlDebounceTimerRef.current = null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}, [isInitialized, favoriteRelaysIdentity, blockedRelaysIdentity, replyExtraRelaysIdentity, updateFeedRelayUrls]) |
|
|
|
}, [isInitialized, favoriteRelaysIdentity, blockedRelaysIdentity, replyExtraRelaysIdentity, updateFeedRelayUrls]) |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
|