mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-06-14 20:11:22 +00:00
Merge pull request #85 from Qortal/bugfix/block-data-startup
fix blocked info at startup
This commit is contained in:
commit
3da85a5078
@ -397,7 +397,7 @@ function App() {
|
|||||||
addToBlockList,
|
addToBlockList,
|
||||||
removeBlockFromList,
|
removeBlockFromList,
|
||||||
getAllBlockedUsers,
|
getAllBlockedUsers,
|
||||||
} = useBlockedAddresses();
|
} = useBlockedAddresses(extState === 'authenticated');
|
||||||
|
|
||||||
const [currentNode, setCurrentNode] = useState({
|
const [currentNode, setCurrentNode] = useState({
|
||||||
url: 'http://127.0.0.1:12391',
|
url: 'http://127.0.0.1:12391',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
||||||
|
|
||||||
export const useBlockedAddresses = () => {
|
export const useBlockedAddresses = (isAuthenticated?: boolean) => {
|
||||||
const userBlockedRef = useRef({});
|
const userBlockedRef = useRef({});
|
||||||
const userNamesBlockedRef = useRef({});
|
const userNamesBlockedRef = useRef({});
|
||||||
|
|
||||||
@ -22,6 +22,9 @@ export const useBlockedAddresses = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!isAuthenticated) return;
|
||||||
|
userBlockedRef.current = {};
|
||||||
|
userNamesBlockedRef.current = {};
|
||||||
const fetchBlockedList = async () => {
|
const fetchBlockedList = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await new Promise((res, rej) => {
|
const response = await new Promise((res, rej) => {
|
||||||
@ -82,7 +85,7 @@ export const useBlockedAddresses = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
fetchBlockedList();
|
fetchBlockedList();
|
||||||
}, []);
|
}, [isAuthenticated]);
|
||||||
|
|
||||||
const removeBlockFromList = useCallback(async (address, name) => {
|
const removeBlockFromList = useCallback(async (address, name) => {
|
||||||
if (name) {
|
if (name) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user