fix(author): keep the follow sub-tab state out of the other panels

uhSub(粉丝/关注)只属于粉丝面板,loadPanelBody 却把它写在每一个面板上,
翻页时又从被点面板自身读回,于是分组状态跨面板串味:先点粉丝 tab 切到
「关注」,再点文章 tab 翻页,#panel-posts 会被永久打上 data-uh-sub=
"following",之后粉丝面板的翻页读到的是文章面板残留的分组。

翻页改为只读**当前面板内**的 .is-active 子页签,读不到就回落默认分组;
uhPage / uhSub 也只在粉丝面板写入,文章 / 收藏 / 评论面板一次都不碰。
目标面板本身仍由被点面板的 id 反解,跨面板跳转这条路径不存在,本次不动。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-04 14:28:43 +08:00
co-authored by Claude Fable 5
parent 16d67c8a87
commit 00817766a6
2 changed files with 24 additions and 4 deletions
@@ -593,6 +593,15 @@ test('public user home stays param-free and swaps panels via REST fragments', ()
assert.match(authorJs, /data-uh-sub/);
assert.match(authorJs, /post_ajax\.ed/);
assert.match(authorJs, /window\.auto_fun\(\)/);
// 翻页拿子分组只读**当前面板内**的 is-active 子页签,不读 panel.dataset:
// uhSub 是粉丝面板私有状态,写满所有面板会互相串味 —— 先点过粉丝子页签,
// 残留值会长在文章面板上,之后粉丝面板翻页读到的是别人的分组。
assert.match(authorJs, /panel\.querySelector\('\[data-uh-sub\]\.is-active'\)/);
assert.doesNotMatch(authorJs, /loadPanelBody\(panel, name, page, panel\.dataset\.uhSub/);
// uhPage / uhSub 只写粉丝面板;文章 / 收藏 / 评论面板没有子页签。
assert.match(authorJs, /if \(name === 'follow'\) \{[\s\S]{0,120}panel\.dataset\.uhSub = followSub;/);
assert.doesNotMatch(authorJs, /var followSub = sub \|\| panel\.dataset\.uhSub \|\| 'followers';/);
});
test('single articles enqueue only content and settings driven assets', () => {