Fix inefficient queryClient update when relay URL changes

This commit is contained in:
Alex Gleason committed 2025-10-16 18:42:35 -05:00
1 parent a974da9f88
commit 49abb22471
3 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -20,10 +20,10 @@ const NostrProvider: React.FC<NostrProviderProps> = (props) => {
// Use refs so the pool always has the latest data
const relayUrl = useRef<string>(config.relayUrl);
// Update refs when config changes
// Invalidate Nostr queries when relayUrl changes
useEffect(() => {
relayUrl.current = config.relayUrl;
queryClient.resetQueries();
queryClient.invalidateQueries({ queryKey: ['nostr'] });
}, [config.relayUrl, queryClient]);
// Initialize NPool only once