Merge pull request #85 from Qortal/bugfix/block-data-startup

fix blocked info at startup
This commit is contained in:
Phillip 2025-06-12 17:45:08 +03:00 committed by GitHub
commit 3da85a5078
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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) {