mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
no need to reload everything when websocket connection status changes
This commit is contained in:
@@ -102,16 +102,19 @@ export default function Layout(props: LayoutProps) {
|
|||||||
const handleResize = (element: HTMLElement) => dispatch(setSidebarWidth(element.offsetWidth))
|
const handleResize = (element: HTMLElement) => dispatch(setSidebarWidth(element.offsetWidth))
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// load initial data
|
||||||
dispatch(reloadSettings())
|
dispatch(reloadSettings())
|
||||||
dispatch(reloadProfile())
|
dispatch(reloadProfile())
|
||||||
dispatch(reloadTree())
|
dispatch(reloadTree())
|
||||||
dispatch(reloadTags())
|
dispatch(reloadTags())
|
||||||
|
}, [dispatch])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
// reload tree periodically if not receiving websocket events
|
// reload tree periodically if not receiving websocket events
|
||||||
const id = setInterval(() => {
|
const timer = setInterval(() => {
|
||||||
if (!webSocketConnected) dispatch(reloadTree())
|
if (!webSocketConnected) dispatch(reloadTree())
|
||||||
}, 30000)
|
}, 30000)
|
||||||
return () => clearInterval(id)
|
return () => clearInterval(timer)
|
||||||
}, [dispatch, webSocketConnected])
|
}, [dispatch, webSocketConnected])
|
||||||
|
|
||||||
const burger = (
|
const burger = (
|
||||||
|
|||||||
Reference in New Issue
Block a user