修复通讯录顶部入口箭头图标错位、群管理员列表移除后读到服务端过期缓存
- .people-entry-list > button 是4列grid,最后一列专留给箭头图标,但"新朋友"未处理申请数为0/ "群组"/"文件助手"/"系统消息"这几个入口没有badge时,JSX只渲染3个真实子元素,grid自动布局 把箭头挤进第3列——实测空出623px空白,图标紧贴文字,完全不是贴右对齐效果。改成显式 grid-column:4 钉住箭头位置,不再依赖前面到底渲染了几个兄弟节点。 - AdminList移除管理员后紧接着的load()重新查询命中了服务端对这个查询形状的过期缓存,界面上 刚移除的管理员会短暂"复活"。改成移除成功后直接用已确认生效的结果本地更新state+patch共享 缓存,不再指望立即重新查询能反映刚发生的变更(这个缓存问题本身是后端"新增7"已记录的问题, 重新查询本身没有办法绕过,前端这次做的是不依赖它)。 均已用真实DOM结构/computed style确认修复生效。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
7db687602b
commit
8b51fd3eb8
@@ -725,8 +725,18 @@ function AdminList({topic, onToast}) {
|
||||
}, [topic]);
|
||||
React.useEffect(() => { load(); }, [load]);
|
||||
const remove = userId => {
|
||||
deleteGroupAdmin(topic, userId).then(() => { setToast('管理员已移除'); load(); })
|
||||
.catch(err => onToast(err.message || '操作失败'));
|
||||
// deleteGroupAdmin succeeding doesn't mean a follow-up load() will show it -- getGroupMembers
|
||||
// is backed by a server-side cache that this exact query shape can keep serving stale for a
|
||||
// while (confirmed live: an unfiltered re-query right after removal still showed the removed
|
||||
// admin, while a query with different params the session hadn't used yet returned correctly).
|
||||
// Patch the already-known-correct result into local state and the shared cache directly
|
||||
// instead of trusting a re-fetch to reflect what was just confirmed to have happened.
|
||||
deleteGroupAdmin(topic, userId).then(() => {
|
||||
setToast('管理员已移除');
|
||||
setAdmins(prev => prev ? prev.filter(a => a.user_id !== userId) : prev);
|
||||
const cached = readCachedData('group-members:' + topic);
|
||||
if (cached) writeCachedData('group-members:' + topic, cached.map(m => m.user_id === userId ? {...m, role: 'member'} : m));
|
||||
}).catch(err => onToast(err.message || '操作失败'));
|
||||
};
|
||||
return <div className="group-page">
|
||||
<Header title="设置群管理员" back="group-governance" backTopic={topic} right="添加" onRight={() => navigate('group-admin-add', topic)} />
|
||||
|
||||
Reference in New Issue
Block a user