Repository navigation
Conversation
扫码登录页原本按 roster 文件顺序画(CodeArts 因为字母靠前永远第一)。给第九个渠道加了账号之后,那一行还在第九位,用户得滚过八个没碰过的渠道才能确认这次点击到底成了没有。 现在按「最近添加」倒序:新加过账号的渠道浮到最上面,还没账号的渠道在下面保持 roster 顺序(新装用户没有可排的依据,打乱只会看着像随机)。 时间从两处取,取较大者: - pack 账号自己的 createdAt(account.create 写入,登录成功后的改名会保留它;重启后仍在,覆盖 pack 拥有的十三个渠道)。 - 本机 localStorage 记的添加时刻(补 account.list 还没刷新的那几秒,也是豆包唯一的来源——豆包走插件自己的 lane,没有 pack 账号行,否则每次重启都会掉回最后一位)。 pack 为「凭据在盘上但没有 pool 条目」合成的行写 createdAt: 0,这类和缺失一律当未知,不参与排序。时间戳相同时按传入顺序(roster 顺序)兜底,避免两次渲染之间无谓换位。 验证:新增 tests/channel-order.test.ts(19 项,覆盖取大者、0/NaN 丢弃、无活动时不动、并列稳定、不改入参、两条登录路径都打戳、localStorage 往返与损坏数据、accountsFrom 不丢 createdAt);tsc 宿主+客户端均 exit 0,tsdown 重建 lib/client.js;vitest 1411 passed,仅 windows-registry-encoding 那 2 项因本机 D: 只读失败(已知)。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
扫码登录页按
channel-roster.ts的书写顺序渲染(CodeArts 因为字母靠前永远第一行)。给第九个渠道加完账号,那一行还停在第九位 —— 用户得滚过八个没碰过的渠道,才能确认刚才那次点击到底成了没有。改法
按「最近添加」倒序排列:加过账号的渠道浮到最上面,还没账号的渠道在下面保持 roster 顺序(新装用户没有可排的依据,打乱只会看着像随机)。
时间取两处中较大者:
account.createdAtlocalStorage的添加时刻account.list刷新前的几秒;豆包唯一的来源豆包走插件自己的 lane,没有 pack 账号行,只靠
createdAt的话每次重启都会掉回最后一位。边界处理
createdAt: 0,这类和字段缺失一律当未知,不参与排序 —— 否则会和「从未添加」并列,把兜底顺序搅乱。localStorage读,不放 effect 里 —— 否则会先画 roster 顺序再重排,用户回来要找的那一行会在光标底下跳一下。验证
tests/channel-order.test.ts(19 项):取大者、0/NaN丢弃、无活动时不动、并列稳定、不改入参、两条登录路径(login.poll/ 豆包)都打戳、localStorage往返与损坏数据、accountsFrom不丢createdAt。tsc -p tsconfig.json与tsc -p tsconfig.client.json均 exit 0;tsdown重建lib/client.js(按仓库约定lib/一起提交)。vitest run:1411 passed,仅windows-registry-encoding.test.ts那 2 项失败 —— 本机 D: 是只读光驱,CI 的windows-latest不受影响(已知问题)。