跳到主要内容

ExpectedActiveBranch

Defined in: packages/rxdb-plugin-working-tree/src/working-tree/write-entry.ts:289

调用方提出的那份 active 分支断言(StaleActiveBranchError.expected 的类型)

Remarks​

比 ActiveBranchToken 松一格,松的正是 branchId:写路径的调用方交的是完整捕获值 (ActiveBranchToken 直接可赋值过来),而 switchBranch(branchId, options) 的调用方 经公开入口 RxDBBranchSwitchPreconditions 只交得出 expectedActivationRevision 一个数——那个形状被一条「不多不少就这两个字段」的类型断言钉住,里面没有分支这一格。

null 写的是「没表态」,不是「不知道」。 此前那一处拿库里当前的 branchId 去补, 补出来的是一个从未存在过的 token(B@3:调用方其实在 A@3,库里是 B@7),而消费者会照着 expected.branchId 去查 B。判定本身不需要这一格:activationRevision 是库级单行 (working-tree-activation-state,每次切换 +1),单凭代际号就把激活态钉死了。

Properties​

activationRevision​

readonly activationRevision: number;

Defined in: packages/rxdb-plugin-working-tree/src/working-tree/write-entry.ts:294

调用方捕获或断言的 activation revision


branchId​

readonly branchId: string | null;

Defined in: packages/rxdb-plugin-working-tree/src/working-tree/write-entry.ts:291

调用方捕获的 active 分支 ID;null = 调用方只断言了代际,没对分支表态