From 7672feca21cf61c9ebb04e67dcc95cd6bd93418e Mon Sep 17 00:00:00 2001 From: Grace Kind Date: Fri, 8 May 2026 23:20:57 -0500 Subject: [PATCH] Key request status wrappers and remove unused wrappers --- package.json | 2 +- src/js/dataLayer/requests.js | 63 ++++++++++++++++++--------- src/js/views/chatDetail.view.js | 5 ++- src/js/views/postLikes.view.js | 5 ++- src/js/views/postQuotes.view.js | 5 ++- src/js/views/postReposts.view.js | 5 ++- src/js/views/postThread.view.js | 5 ++- src/js/views/profile.view.js | 4 +- src/js/views/profileFollowers.view.js | 2 +- src/js/views/profileFollowing.view.js | 5 ++- src/js/views/search.view.js | 12 +++-- 11 files changed, 74 insertions(+), 39 deletions(-) diff --git a/package.json b/package.json index 0789bf10..e88d7a89 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "impro", - "version": "0.11.81", + "version": "0.11.82", "type": "module", "scripts": { "start": "rm -rf build && NODE_ENV=development eleventy --serve", diff --git a/src/js/dataLayer/requests.js b/src/js/dataLayer/requests.js index a1194407..ea600b06 100644 --- a/src/js/dataLayer/requests.js +++ b/src/js/dataLayer/requests.js @@ -71,37 +71,58 @@ export class Requests { this.constellation = constellation ?? new Constellation(); this.normalizer = new Normalizer(); this.statusStore = new StatusStore(); - - this.enableStatus(this.loadCurrentUser, "loadCurrentUser"); - this.enableStatus(this.loadPostThread, "loadPostThread"); - this.enableStatus(this.loadPost, "loadPost"); + // Enable status tracking + this.enableStatus( + this.loadPostThread, + (postUri) => "loadPostThread-" + postUri, + ); this.enableStatus( this.loadNextFeedPage, (feedURI) => "loadNextFeedPage-" + feedURI, ); - this.enableStatus(this.loadProfile, "loadProfile"); - this.enableStatus(this.loadNextAuthorFeedPage, "loadNextAuthorFeedPage"); - this.enableStatus(this.loadProfileSearch, "loadProfileSearch"); - this.enableStatus(this.loadPostSearch, "loadPostSearch"); - this.enableStatus(this.loadFeedSearch, "loadFeedSearch"); + this.enableStatus(this.loadProfile, (did) => "loadProfile-" + did); + this.enableStatus( + this.loadProfileSearch, + (query) => "loadProfileSearch-" + query, + ); + this.enableStatus( + this.loadPostSearch, + (query, { sort = "top" } = {}) => `loadPostSearch-${query}-${sort}`, + ); + this.enableStatus( + this.loadFeedSearch, + (query) => "loadFeedSearch-" + query, + ); this.enableStatus(this.loadNotifications, "loadNotifications"); this.enableStatus( this.loadMentionNotifications, "loadMentionNotifications", ); this.enableStatus(this.loadConvoList, "loadConvoList"); - this.enableStatus(this.loadConvo, "loadConvo"); - this.enableStatus(this.loadConvoMessages, "loadConvoMessages"); - this.enableStatus(this.loadPostLikes, "loadPostLikes"); - this.enableStatus(this.loadPostQuotes, "loadPostQuotes"); - this.enableStatus(this.loadPostReposts, "loadPostReposts"); - this.enableStatus(this.loadFeedGenerator, "loadFeedGenerator"); - this.enableStatus(this.loadHashtagFeed, "loadHashtagFeed"); - this.enableStatus(this.loadBookmarks, "loadBookmarks"); - this.enableStatus(this.loadProfileFollowers, "loadProfileFollowers"); - this.enableStatus(this.loadProfileFollows, "loadProfileFollows"); - this.enableStatus(this.loadProfileChatStatus, "loadProfileChatStatus"); - this.enableStatus(this.loadLabelerInfo, "loadLabelerInfo"); + this.enableStatus( + this.loadConvoMessages, + (convoId) => "loadConvoMessages-" + convoId, + ); + this.enableStatus( + this.loadPostLikes, + (postUri) => "loadPostLikes-" + postUri, + ); + this.enableStatus( + this.loadPostQuotes, + (postUri) => "loadPostQuotes-" + postUri, + ); + this.enableStatus( + this.loadPostReposts, + (postUri) => "loadPostReposts-" + postUri, + ); + this.enableStatus( + this.loadProfileFollowers, + (profileDid) => "loadProfileFollowers-" + profileDid, + ); + this.enableStatus( + this.loadProfileFollows, + (profileDid) => "loadProfileFollows-" + profileDid, + ); } requireLabelers() { diff --git a/src/js/views/chatDetail.view.js b/src/js/views/chatDetail.view.js index 34286ea0..e72fab1b 100644 --- a/src/js/views/chatDetail.view.js +++ b/src/js/views/chatDetail.view.js @@ -618,8 +618,9 @@ class ChatDetailView extends View { chatNotificationService?.getNumNotifications() ?? 0; const messagesData = dataLayer.selectors.getConvoMessages(convoId); const messages = messagesData?.messages ?? null; - const messagesRequestStatus = - dataLayer.requests.getStatus("loadMessages"); + const messagesRequestStatus = dataLayer.requests.getStatus( + "loadConvoMessages-" + convoId, + ); const hasMore = !!messagesData?.cursor; // Get convo details to show other member info diff --git a/src/js/views/postLikes.view.js b/src/js/views/postLikes.view.js index 989acc24..606877b8 100644 --- a/src/js/views/postLikes.view.js +++ b/src/js/views/postLikes.view.js @@ -80,8 +80,9 @@ class PostLikesView extends View { chatNotificationService?.getNumNotifications() ?? null; const postLikes = dataLayer.selectors.getPostLikes(postUri); const post = dataLayer.selectors.getPost(postUri); - const postLikesRequestStatus = - dataLayer.requests.getStatus("loadPostLikes"); + const postLikesRequestStatus = dataLayer.requests.getStatus( + "loadPostLikes-" + postUri, + ); const hasMore = postLikes?.cursor ? true : false; const subtitle = post?.likeCount diff --git a/src/js/views/postQuotes.view.js b/src/js/views/postQuotes.view.js index 57df953b..91c1b9f4 100644 --- a/src/js/views/postQuotes.view.js +++ b/src/js/views/postQuotes.view.js @@ -56,8 +56,9 @@ class PostQuotesView extends View { chatNotificationService?.getNumNotifications() ?? null; const postQuotes = dataLayer.selectors.getPostQuotes(postUri); const post = dataLayer.selectors.getPost(postUri); - const postQuotesRequestStatus = - dataLayer.requests.getStatus("loadPostQuotes"); + const postQuotesRequestStatus = dataLayer.requests.getStatus( + "loadPostQuotes-" + postUri, + ); const subtitle = post?.quoteCount ? `${formatLargeNumber(post.quoteCount)} ${ diff --git a/src/js/views/postReposts.view.js b/src/js/views/postReposts.view.js index 9b9c9155..f19f55f8 100644 --- a/src/js/views/postReposts.view.js +++ b/src/js/views/postReposts.view.js @@ -81,8 +81,9 @@ class PostRepostsView extends View { chatNotificationService?.getNumNotifications() ?? null; const postReposts = dataLayer.selectors.getPostReposts(postUri); const post = dataLayer.selectors.getPost(postUri); - const postRepostsRequestStatus = - dataLayer.requests.getStatus("loadPostReposts"); + const postRepostsRequestStatus = dataLayer.requests.getStatus( + "loadPostReposts-" + postUri, + ); const hasMore = postReposts?.cursor ? true : false; const subtitle = post?.repostCount ? `${formatLargeNumber(post.repostCount)} ${ diff --git a/src/js/views/postThread.view.js b/src/js/views/postThread.view.js index 9066d9f7..67779ed5 100644 --- a/src/js/views/postThread.view.js +++ b/src/js/views/postThread.view.js @@ -484,8 +484,9 @@ class PostThreadView extends View { notificationService?.getNumNotifications() ?? null; const numChatNotifications = chatNotificationService?.getNumNotifications() ?? null; - const postThreadRequestStatus = - dataLayer.requests.getStatus("loadPostThread"); + const postThreadRequestStatus = dataLayer.requests.getStatus( + "loadPostThread-" + postUri, + ); render( html`
${mainLayoutTemplate({ diff --git a/src/js/views/profile.view.js b/src/js/views/profile.view.js index 219e6736..0afd2090 100644 --- a/src/js/views/profile.view.js +++ b/src/js/views/profile.view.js @@ -455,7 +455,9 @@ class ProfileView extends View { notificationService?.getNumNotifications() ?? null; const numChatNotifications = chatNotificationService?.getNumNotifications() ?? null; - const profileRequestStatus = dataLayer.requests.getStatus("loadProfile"); + const profileRequestStatus = dataLayer.requests.getStatus( + "loadProfile-" + profileDid, + ); const isLabeler = profile && isLabelerProfile(profile); const labelerInfo = isLabeler ? dataLayer.selectors.getLabelerInfo(profile.did) diff --git a/src/js/views/profileFollowers.view.js b/src/js/views/profileFollowers.view.js index 5f5de4a2..bb4a8b94 100644 --- a/src/js/views/profileFollowers.view.js +++ b/src/js/views/profileFollowers.view.js @@ -85,7 +85,7 @@ class ProfileFollowersView extends View { dataLayer.selectors.getProfileFollowers(profileDid); const profile = dataLayer.selectors.getProfile(profileDid); const profileFollowersRequestStatus = dataLayer.requests.getStatus( - "loadProfileFollowers", + "loadProfileFollowers-" + profileDid, ); const hasMore = profileFollowers?.cursor ? true : false; diff --git a/src/js/views/profileFollowing.view.js b/src/js/views/profileFollowing.view.js index 037d3a57..928cb5cc 100644 --- a/src/js/views/profileFollowing.view.js +++ b/src/js/views/profileFollowing.view.js @@ -84,8 +84,9 @@ class ProfileFollowingView extends View { const profileFollowing = dataLayer.selectors.getProfileFollows(profileDid); const profile = dataLayer.selectors.getProfile(profileDid); - const profileFollowingRequestStatus = - dataLayer.requests.getStatus("loadProfileFollows"); + const profileFollowingRequestStatus = dataLayer.requests.getStatus( + "loadProfileFollows-" + profileDid, + ); const hasMore = profileFollowing?.cursor ? true : false; const subtitle = profile?.followsCount diff --git a/src/js/views/search.view.js b/src/js/views/search.view.js index 85add78d..cf6fd99f 100644 --- a/src/js/views/search.view.js +++ b/src/js/views/search.view.js @@ -361,9 +361,15 @@ class SearchView extends View { chatNotificationService?.getNumNotifications() ?? null; const normalizedQuery = state.searchQuery.trim(); const showResults = normalizedQuery.length > 0; - const postStatus = dataLayer.requests.getStatus("loadPostSearch"); - const profileStatus = dataLayer.requests.getStatus("loadProfileSearch"); - const feedStatus = dataLayer.requests.getStatus("loadFeedSearch"); + const postStatus = dataLayer.requests.getStatus( + `loadPostSearch-${normalizedQuery}-top`, + ); + const profileStatus = dataLayer.requests.getStatus( + "loadProfileSearch-" + normalizedQuery, + ); + const feedStatus = dataLayer.requests.getStatus( + "loadFeedSearch-" + normalizedQuery, + ); const postSearchResults = dataLayer.selectors.getPostSearchResults(); const profileSearchResults = dataLayer.selectors.getProfileSearchResults(); -- 2.51.2