mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-26 02:04:37 +08:00
fix(contacts): refresh promoted friend rows
Replace friend rows after manual friend promotion so response-layer overrides are reflected even when the contacts snapshot signature is unchanged. Keep preserving the groupmate rows after local removal to avoid scroll jumps.
This commit is contained in:
1 parent
0e318f5bca
commit
e784a16483
3 files changed
+16
-2
No files matched your search
@@ -12,6 +12,7 @@ import {
|
||||
shouldShowGroupmateSection,
|
||||
shouldShowContactsLoadingState,
|
||||
shouldHoldCompletedContactsTaskProgress,
|
||||
shouldPreserveFriendActionRefreshRows,
|
||||
} from './contacts-view-state'
|
||||
|
||||
function diagnostics(overrides: Partial<ContactsDiagnostics> = {}): ContactsDiagnostics {
|
||||
@@ -92,6 +93,14 @@ test('preserves scroll position for friend section friend actions', () => {
|
||||
)
|
||||
})
|
||||
|
||||
test('replaces friend rows after a groupmate is marked as friend', () => {
|
||||
assert.equal(shouldPreserveFriendActionRefreshRows('friend'), false)
|
||||
})
|
||||
|
||||
test('keeps preserving groupmate rows after local removal during friend actions', () => {
|
||||
assert.equal(shouldPreserveFriendActionRefreshRows('non_friend'), true)
|
||||
})
|
||||
|
||||
test('shows groupmate section immediately when the groupmate tab is active', () => {
|
||||
assert.equal(
|
||||
shouldShowGroupmateSection({
|
||||
|
||||
@@ -50,6 +50,10 @@ export function resolveFriendActionScrollTop(state: FriendActionScrollState): nu
|
||||
return state.previousScrollTop
|
||||
}
|
||||
|
||||
export function shouldPreserveFriendActionRefreshRows(pool: ContactPoolTab): boolean {
|
||||
return pool !== 'friend'
|
||||
}
|
||||
|
||||
export function shouldShowGroupmateSection(state: GroupmateSectionVisibilityState): boolean {
|
||||
return state.activeSection === 'non_friend' || state.friendSectionReady
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
resolveFriendActionScrollTop,
|
||||
resolveContactsPollingPools,
|
||||
shouldHoldCompletedContactsTaskProgress,
|
||||
shouldPreserveFriendActionRefreshRows,
|
||||
shouldShowContactsDisabledNotice,
|
||||
shouldShowContactsLoadingState,
|
||||
shouldShowGroupmateSection,
|
||||
@@ -649,13 +650,13 @@ async function refreshContactsPageMetadata() {
|
||||
loadContactsPage('friend', 1, {
|
||||
acceptStale: true,
|
||||
replace: true,
|
||||
preserveExisting: true,
|
||||
preserveExisting: shouldPreserveFriendActionRefreshRows('friend'),
|
||||
silent: true,
|
||||
}),
|
||||
loadContactsPage('non_friend', 1, {
|
||||
acceptStale: true,
|
||||
replace: true,
|
||||
preserveExisting: true,
|
||||
preserveExisting: shouldPreserveFriendActionRefreshRows('non_friend'),
|
||||
silent: true,
|
||||
}),
|
||||
])
|
||||
|
||||
Reference in new issue
Block a user