fix(导航): 排查全项目后修复其余同类tab切换污染历史记录问题
上一提交(e61eb402)只修了"我的收藏"/"查找聊天记录"两处,用户要求排查其他页面是否
也有同样问题。全项目排查<nav>/tabbar/active态切换元素,逐一确认onClick是否直接调用
HashNavigation.navigateTo()(每次都push一条历史记录),找到5处同类实例并修复:
- message-center-view.jsx / workplace-collaboration-view.jsx:底部导航"工作台"<->"消息"
两个tab——这是全应用唯一的根级tab bar,也是点击频率最高的一处,之前同样每次切换都
push一条历史记录。
- workplace-collaboration-view.jsx:日报/月报列表页的"我的xx"<->"团队统计"切换(同一个
组件、同一个页面,只是team boolean不同),同样的问题。
- new-topic-view.jsx:"开始新会话"页的搜索/新群组/通过id三个tab。
- wallpapers.jsx:"壁纸"设置页的图案/图片两个tab。
均改用上一提交新增的HashNavigation.navigateReplace()。已在浏览器逐一实测:连续切换
多次tab后,无论真实浏览器返回还是应用自己的返回按钮,都能一次性返回到进入该页面之前
的真实上一页。
以下经排查确认不受影响,未改动:group-management-view.jsx的群聊分类tab(我创建的/
管理的/加入的)和contact-management-view.jsx的字母索引锚点均只用本地state/scrollIntoView,
不涉及hash跳转;auth-onboarding-view.jsx的登录<->注册切换、new-topic-view.jsx提交后的
三处跳转是真实的"离开当前页"操作,保留push语义符合预期。
This commit is contained in:
@@ -20,6 +20,15 @@ const navigate = (view, topic) => {
|
||||
HashNavigation.navigateTo(hash);
|
||||
};
|
||||
|
||||
// BottomNavigation's 消息<->工作台 switch is the app's root-level tab bar, not a navigation to a
|
||||
// "different page" in the back-stack sense -- same bug/fix as content-library-view.jsx's
|
||||
// navigateReplace (see its comment): navigate() here pushed a history entry on every tab click, so
|
||||
// bouncing between 消息 and 工作台 a few times (a completely normal usage pattern for the app's only
|
||||
// two bottom tabs) made the back button just cycle through past tab switches instead of leaving the
|
||||
// app, exactly like a standard bottom-tab-bar app's back button should not have to unwind every past
|
||||
// tab switch to back out.
|
||||
const navigateReplace = (view) => HashNavigation.navigateReplace(HashNavigation.setUrlSidePanel(window.location.hash, view));
|
||||
|
||||
// Was a hardcoded FREQUENT_CONTACTS mock (5 fake names, always clicking through to the same
|
||||
// direct-message-view.jsx demo regardless of which avatar was tapped -- confirmed independently by
|
||||
// a user screenshot showing every contact opening the identical "接语彤" script). Real "frequently
|
||||
@@ -183,7 +192,7 @@ function normalizeConversations(chatList, myUserId) {
|
||||
|
||||
function BottomNavigation() {
|
||||
return <nav className="messages-bottom-nav" aria-label="主导航">
|
||||
<button type="button" onClick={() => navigate('workbench')}><Icon>dashboard</Icon><span>工作台</span></button>
|
||||
<button type="button" onClick={() => navigateReplace('workbench')}><Icon>dashboard</Icon><span>工作台</span></button>
|
||||
<button type="button" className="active"><Icon>person</Icon><span>消息</span></button>
|
||||
</nav>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user