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))
|
||||
|
||||
useEffect(() => {
|
||||
// load initial data
|
||||
dispatch(reloadSettings())
|
||||
dispatch(reloadProfile())
|
||||
dispatch(reloadTree())
|
||||
dispatch(reloadTags())
|
||||
}, [dispatch])
|
||||
|
||||
useEffect(() => {
|
||||
// reload tree periodically if not receiving websocket events
|
||||
const id = setInterval(() => {
|
||||
const timer = setInterval(() => {
|
||||
if (!webSocketConnected) dispatch(reloadTree())
|
||||
}, 30000)
|
||||
return () => clearInterval(id)
|
||||
return () => clearInterval(timer)
|
||||
}, [dispatch, webSocketConnected])
|
||||
|
||||
const burger = (
|
||||
|
||||
Reference in New Issue
Block a user