diff options
author | Vitaly Takmazov | 2022-11-20 00:17:46 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:59 +0300 |
commit | d3cfc10a2087579f44b3bf91576c2f4ca518326a (patch) | |
tree | ccf716e03baec85fb516d9e7067daeb0fbf29cc7 /vnext/src/App.js | |
parent | f06dbc1b6e99ad7735b9cfd4edd0efe2a835e2e2 (diff) |
Minor fixes
Diffstat (limited to 'vnext/src/App.js')
-rw-r--r-- | vnext/src/App.js | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/vnext/src/App.js b/vnext/src/App.js index bcd2b169..69ceb456 100644 --- a/vnext/src/App.js +++ b/vnext/src/App.js @@ -57,6 +57,18 @@ export default function App({ footer }) { const [eventSource, setEventSource] = /** @param EventSource? */ useState({}); + /** + * @param {import("./api").SecureUser} visitor + */ + let auth = useCallback((visitor) => { + setVisitor(prevState => { + if (visitor.hash != prevState.hash) { + setHash(visitor.hash); + } + return visitor; + }); + }, [setVisitor]); + useEffect(() => { let es; const anonymousUser = { @@ -90,7 +102,7 @@ export default function App({ footer }) { es.removeEventListener('msg', updateStatus); } }); - }, [hash, setVisitor, updateStatus]); + }, [auth, hash, setVisitor, updateStatus]); useEffect(() => { const getTrends = async () => { @@ -99,17 +111,6 @@ export default function App({ footer }) { getTrends().catch(console.error); }, []); - /** - * @param {import("./api").SecureUser} visitor - */ - let auth = useCallback((visitor) => { - setVisitor(prevState => { - if (visitor.hash != prevState.hash) { - setHash(visitor.hash); - } - return visitor; - }); - }, [setVisitor]); return ( <> <Header /> |