From 6b988dffa8be221bb217284aa22aa9a27e4852db Mon Sep 17 00:00:00 2001 From: jolavillette Date: Sun, 16 Aug 2026 13:06:50 +0200 Subject: [PATCH] webui v143: the channel list never refreshed, and three different periods The scope predicate of the channel list background task was entirely commented out, so it returned undefined: setBackgroundTask stopped after the first interval and the list was loaded once, never refreshed while the page stayed open. It now tests the route like the boards one does. The three group lists polled at three different periods: forums every 5 s, boards every 30 s, channels never. Each poll fetches the whole summaries list, and on a phone it costs a fresh TCP handshake on a server that answers one request at a time. All three now share the boards period, named per page. --- webui-src/app/boards/boards.js | 5 ++++- webui-src/app/channels/channels.js | 14 +++++++++++--- webui-src/app/forums/forums.js | 8 +++++++- webui-src/app/main.js | 4 ++-- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/webui-src/app/boards/boards.js b/webui-src/app/boards/boards.js index 758a291..c80a4c8 100644 --- a/webui-src/app/boards/boards.js +++ b/webui-src/app/boards/boards.js @@ -36,6 +36,9 @@ const getBoards = { }, }; +// Group lists change on the scale of a conversation, not of a frame. +const BOARD_LIST_REFRESH_MS = 30000; + const sections = { MyBoards: require('boards/my_boards'), Subscribed: require('boards/subscribed_boards'), @@ -48,7 +51,7 @@ const Layout = () => { return { oninit: () => { - rs.setBackgroundTask(getBoards.load, 30000, () => { + rs.setBackgroundTask(getBoards.load, BOARD_LIST_REFRESH_MS, () => { return m.route.get().startsWith('/boards'); }); peopleUtil.ownIds((data) => { diff --git a/webui-src/app/channels/channels.js b/webui-src/app/channels/channels.js index 58c04e2..d4f4571 100644 --- a/webui-src/app/channels/channels.js +++ b/webui-src/app/channels/channels.js @@ -40,6 +40,9 @@ const getChannels = { }, }; +// Group lists change on the scale of a conversation, not of a frame. +const CHANNEL_LIST_REFRESH_MS = 30000; + const sections = { MyChannels: require('channels/my_channels'), Subscribed: require('channels/subscribed_channels'), @@ -52,9 +55,14 @@ const Layout = () => { return { oninit: () => { - rs.setBackgroundTask(getChannels.load, 5000, () => { - // return m.route.get() === '/files/files'; - }); + // The scope predicate used to be commented out, so it returned undefined + // and setBackgroundTask stopped after the first interval: the channel list + // was loaded once and never refreshed while the page stayed open. Same + // period as the boards list, which asks the same kind of question -- a + // five second poll of a whole summaries list is a lot to pay on a phone. + rs.setBackgroundTask(getChannels.load, CHANNEL_LIST_REFRESH_MS, () => + m.route.get().startsWith('/channels') + ); peopleUtil.ownIds((data) => { ownId = data; for (let i = 0; i < ownId.length; i++) { diff --git a/webui-src/app/forums/forums.js b/webui-src/app/forums/forums.js index 0dd9187..acc09dd 100644 --- a/webui-src/app/forums/forums.js +++ b/webui-src/app/forums/forums.js @@ -26,6 +26,9 @@ const getForums = { } }, }; +// Group lists change on the scale of a conversation, not of a frame. +const FORUM_LIST_REFRESH_MS = 30000; + const sections = { MyForums: require('forums/my_forums'), Subscribed: require('forums/subscribed_forums'), @@ -38,7 +41,10 @@ const Layout = () => { return { oninit: () => { - rs.setBackgroundTask(getForums.load, 5000, () => { + // Was every 5 s. getForumsSummaries returns the whole list every time, + // and on a phone each poll is a fresh TCP handshake on a server that + // answers one request at a time; the boards list already settled on 30 s. + rs.setBackgroundTask(getForums.load, FORUM_LIST_REFRESH_MS, () => { return m.route.get().includes('/forums'); }); peopleUtil.ownIds((data) => { diff --git a/webui-src/app/main.js b/webui-src/app/main.js index 5105bce..2c8b977 100644 --- a/webui-src/app/main.js +++ b/webui-src/app/main.js @@ -114,7 +114,7 @@ const navbar = () => { ? 'Connected to RetroShare Core' : 'Connection Lost', }), - m('span.webui-version', { style: { fontSize: '0.7em' } }, 'v142'), + m('span.webui-version', { style: { fontSize: '0.7em' } }, 'v143'), m('i.fas.fa-sync-alt.refresh-icon', { style: { cursor: 'pointer', fontSize: '0.8em' }, onclick: () => window.location.reload(true), @@ -236,7 +236,7 @@ const MobileStatus = () => { m('small', statusbar.formatBytes(state.totalOut)), ]), ]), - m('.mobile-status-sheet__version', 'WebUI v142'), + m('.mobile-status-sheet__version', 'WebUI v143'), ])), ]; },