Device paging refresh fix.

Ylian Saint-Hilaire committed Aug 31, 2022 at 22:25 UTC ad2287621929109dd58a46308fc640496e631be3
2 files changed +8 -8
views/default-mobile.handlebars
+4 -4
@@ -1373,7 +1373,7 @@
1373 // Fetch list of meshes, nodes, files
1374 meshserver.send({ action: 'usergroups' });
1375 meshserver.send({ action: 'meshes' });
1376 - meshserver.send({ action: 'nodes' });
1376 + meshserver.send({ action: 'nodes', skip: (devicePagingState == null) ? 0 : devicePagingState.skip });
1377 meshserver.send({ action: 'files' });
1378 authCookieRenewTimer = setInterval(function () { meshserver.send({ action: 'authcookie' }); }, 1800000); // Request a cookie refresh every 30 minutes.
1379 }
@@ -1776,7 +1776,7 @@
1776 updateSelf();
1777
1778 // If our list of nodes may have changes, request the new list now.
1779 - if (message.event.nodeListChange == userinfo._id) { meshserver.send({ action: 'nodes' }); }
1779 + if (message.event.nodeListChange == userinfo._id) { meshserver.send({ action: 'nodes', skip: (devicePagingState == null) ? 0 : devicePagingState.skip }); }
1780 }
1781 break;
1782 }
@@ -1799,7 +1799,7 @@
1799
1800 // Group update, refresh all our device groups and nodes. TODO: Optimize this to only do this when needed.
1801 meshserver.send({ action: 'meshes' });
1802 - meshserver.send({ action: 'nodes' });
1802 + meshserver.send({ action: 'nodes', skip: (devicePagingState == null) ? 0 : devicePagingState.skip });
1803 break;
1804 }
1805 case 'deleteusergroup': {
@@ -1834,7 +1834,7 @@
1834 // This is a new mesh for us
1835 if (add) {
1836 meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links, relayid: message.event.relayid };
1837 - meshserver.send({ action: 'nodes' }); // Request a refresh of all nodes (TODO: We could optimize this to only request nodes for the new mesh).
1837 + meshserver.send({ action: 'nodes', skip: (devicePagingState == null) ? 0 : devicePagingState.skip }); // Request a refresh of all nodes (TODO: We could optimize this to only request nodes for the new mesh).
1838 }
1839 } else {
1840 // This is an existing mesh
views/default.handlebars
+4 -4
@@ -2099,7 +2099,7 @@
2099 // Fetch list of meshes, nodes, files
2100 meshserver.send({ action: 'usergroups' });
2101 meshserver.send({ action: 'meshes' });
2102 - meshserver.send({ action: 'nodes', id: '{{currentNode}}' });
2102 + meshserver.send({ action: 'nodes', id: '{{currentNode}}', skip: (devicePagingState == null) ? 0 : devicePagingState.skip });
2103 meshserver.send({ action: 'loginTokens' });
2104 if (pluginHandler != null) { meshserver.send({ action: 'plugins' }); }
2105 if ('{{currentNode}}'.toLowerCase() == '') { meshserver.send({ action: 'files' }); }
@@ -3104,7 +3104,7 @@
3104 }
3105
3106 // If our list of nodes may have changes, request the new list now.
3107 - if (message.event.nodeListChange == userinfo._id) { meshserver.send({ action: 'nodes' }); }
3107 + if (message.event.nodeListChange == userinfo._id) { meshserver.send({ action: 'nodes', skip: (devicePagingState == null) ? 0 : devicePagingState.skip }); }
3108 }
3109 if (currentNode) { refreshDevice(currentNode._id); }
3110 if (users == null) break;
@@ -3146,7 +3146,7 @@
3146
3147 // Group update, refresh all our device groups and nodes. TODO: Optimize this to only do this when needed.
3148 meshserver.send({ action: 'meshes' });
3149 - meshserver.send({ action: 'nodes' });
3149 + meshserver.send({ action: 'nodes', skip: (devicePagingState == null) ? 0 : devicePagingState.skip });
3150 break;
3151 }
3152 case 'deleteusergroup': {
@@ -3181,7 +3181,7 @@
3181 // This is a new mesh for us
3182 if (add) {
3183 meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links, amt: message.event.amt, invite: message.event.invite, expireDevs: message.event.expireDevs, relayid: message.event.relayid };
3184 - meshserver.send({ action: 'nodes' }); // Request a refresh of all nodes (TODO: We could optimize this to only request nodes for the new mesh).
3184 + meshserver.send({ action: 'nodes', skip: (devicePagingState == null) ? 0 : devicePagingState.skip }); // Request a refresh of all nodes (TODO: We could optimize this to only request nodes for the new mesh).
3185 }
3186 } else {
3187 // This is an existing device group