From 6ef14d985d673f911449c72f65ef9d5b09b8bea9 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sun, 5 Nov 2023 01:07:08 +0000 Subject: [PATCH] Maybe avoid increating load with the wiki app as requested accrue. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4609 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- apps/wiki.json | 2 +- apps/wiki/app.js | 2 -- apps/wiki/tf-collections-app.js | 4 ++++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/wiki.json b/apps/wiki.json index 7568b98e..9ed4e2ba 100644 --- a/apps/wiki.json +++ b/apps/wiki.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "📝", - "previous": "&uHuaLkW5F8E1aJ58hpoz72hWZZHIT2gaExUFSb8D6eI=.sha256" + "previous": "&5DCHb4dlFnAlInCiIb1v7XG+w/t11fVwbpqM8aVLEfQ=.sha256" } \ No newline at end of file diff --git a/apps/wiki/app.js b/apps/wiki/app.js index e6d047f8..ca1c91d0 100644 --- a/apps/wiki/app.js +++ b/apps/wiki/app.js @@ -67,7 +67,6 @@ ssb.addEventListener('message', function(id) { core.register('message', async function message_handler(message) { if (message.event == 'hashChange') { - print('hash change', message.hash); g_hash = message.hash; await tfrpc.rpc.hash_changed(message.hash); } @@ -112,7 +111,6 @@ async function process_message(whoami, collection, message, kind, parent) { } else { content.draft = false; } - print(message.id, content); if (content?.key) { if (content?.tombstone) { delete collection[content.key]; diff --git a/apps/wiki/tf-collections-app.js b/apps/wiki/tf-collections-app.js index 2b135d2b..a9dcb9a9 100644 --- a/apps/wiki/tf-collections-app.js +++ b/apps/wiki/tf-collections-app.js @@ -53,11 +53,15 @@ class TfCollectionsAppElement extends LitElement { if (!this.wiki?.id) { return; } + let start_id = this.wiki.id; let max_rowid; let wiki_docs; while (true) { [max_rowid, wiki_docs] = await tfrpc.rpc.collection(this.owner_ids, 'wiki-doc', this.wiki?.id, max_rowid, wiki_docs); + if (this.wiki?.id !== start_id) { + break; + } this.wiki_docs = wiki_docs; this.update_wiki_doc(); }