fix blocked info at startup

This commit is contained in:
2025-06-12 17:44:36 +03:00
parent 6a1a03e4e6
commit 698ae25ea3
2 changed files with 6 additions and 3 deletions

View File

@@ -397,7 +397,7 @@ function App() {
addToBlockList,
removeBlockFromList,
getAllBlockedUsers,
} = useBlockedAddresses();
} = useBlockedAddresses(extState === 'authenticated');
const [currentNode, setCurrentNode] = useState({
url: 'http://127.0.0.1:12391',

View File

@@ -1,6 +1,6 @@
import { useCallback, useEffect, useMemo, useRef } from 'react';
export const useBlockedAddresses = () => {
export const useBlockedAddresses = (isAuthenticated?: boolean) => {
const userBlockedRef = useRef({});
const userNamesBlockedRef = useRef({});
@@ -22,6 +22,9 @@ export const useBlockedAddresses = () => {
}, []);
useEffect(() => {
if (!isAuthenticated) return;
userBlockedRef.current = {};
userNamesBlockedRef.current = {};
const fetchBlockedList = async () => {
try {
const response = await new Promise((res, rej) => {
@@ -82,7 +85,7 @@ export const useBlockedAddresses = () => {
}
};
fetchBlockedList();
}, []);
}, [isAuthenticated]);
const removeBlockFromList = useCallback(async (address, name) => {
if (name) {