mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-03 08:07:21 +00:00
handle edge case cache reset when user changes relay while logged out then logs in again
This commit is contained in:
1 parent
f379a95548
commit
92eb50f8d2
1 file changed
+4
-3
@@ -1070,9 +1070,10 @@ export function DMProvider({ children, protocolMode = PROTOCOL_MODE.NIP17_ONLY,
|
||||
|
||||
// Detect relay changes and reload messages
|
||||
useEffect(() => {
|
||||
if (!enabled || !userPubkey || !hasInitialLoadCompleted) return;
|
||||
if (previousRelayUrl.current !== config.relayUrl) {
|
||||
previousRelayUrl.current = config.relayUrl;
|
||||
const relayChanged = previousRelayUrl.current !== config.relayUrl;
|
||||
previousRelayUrl.current = config.relayUrl;
|
||||
|
||||
if (relayChanged && enabled && userPubkey && hasInitialLoadCompleted) {
|
||||
clearCacheAndReload();
|
||||
}
|
||||
}, [enabled, userPubkey, config.relayUrl, hasInitialLoadCompleted, clearCacheAndReload]);
|
||||
|
||||
Reference in new issue
Block a user