Show new replies early if the fetch-all-replies task takes long to finish (#36481)

This commit is contained in:
diondiondion authored and GitHub committed 2025-10-15 17:30:47 +00:00
1 parent 28a42bb62c
commit 869eeecfee
3 files changed
+42 -18

No files matched your search

+5 -2
View File
@@ -166,7 +166,10 @@ const updateContext = (state: Draft<State>, status: ApiStatusJSON): void => {
export const contextsReducer = createReducer(initialState, (builder) => {
builder
.addCase(fetchContext.fulfilled, (state, action) => {
if (action.payload.prefetchOnly) {
const currentReplies = state.replies[action.meta.arg.statusId] ?? [];
const hasReplies = currentReplies.length > 0;
// Ignore prefetchOnly if there are no replies - then we can load them immediately
if (action.payload.prefetchOnly && hasReplies) {
storePrefetchedReplies(
state,
action.meta.arg.statusId,
@@ -179,7 +182,7 @@ export const contextsReducer = createReducer(initialState, (builder) => {
action.payload.context,
);
if (action.payload.refresh) {
if (action.payload.refresh && !action.payload.prefetchOnly) {
state.refreshing[action.meta.arg.statusId] = action.payload.refresh;
}
}