Skip to content

Conversation

@weareoutman
Copy link
Member

@weareoutman weareoutman commented Nov 18, 2025

依赖检查

组件之间的依赖声明,是微服务组件架构下的重要信息,请确保其正确性。

请勾选以下两组选项其中之一:

  • 本次 MR 没有使用上游组件(例如框架、后台组件等)的较新版本提供的特性。

或者:

  • 本次 MR 使用了上游组件(例如框架、后台组件等)的较新版本提供的特性。
  • 在对应的文件中更新了该上游组件的依赖版本(或确认了当前声明的依赖版本已包含本次 MR 使用的新特性)。

提交信息检查

Git 提交信息将决定包的版本发布及自动生成的 CHANGELOG,请检查工作内容与提交信息是否相符,并在以下每组选项中都依次确认。

破坏性变更是针对于下游使用者而言,可以通过本次改动对下游使用者的影响来识别变更类型:

  • 下游使用者不做任何改动,仍可以正常工作时,那么它属于普通变更。
  • 反之,下游使用者不做改动就无法正常工作时,那么它属于破坏性变更。

例如,构件修改了一个属性名,小产品 Storyboard 中需要使用新属性名才能工作,那么它就是破坏性变更。
又例如,构件还没有任何下游使用者,那么它的任何变更都是普通变更。

破坏性变更:

  • ⚠️ 本次 MR 包含破坏性变更的提交,请继续确认以下所有选项:
  • 没有更好的兼容方案,必须做破坏性变更。
  • 使用了 feat 作为提交类型。
  • 标注了 BREAKING CHANGE: 你的变更说明
  • 同时更新了本仓库中所有下游使用者的调用。
  • 同时更新了本仓库中所有下游使用者对该子包的依赖为即将发布的 major 版本。
  • 同时为其它仓库的 Migrating 做好了准备,例如文档或批量改动的方法。
  • 手动验证过破坏性变更在 Migrate 后可以正常工作。
  • 破坏性变更所在的提交没有意外携带其它子包的改动。

新特性:

  • 本次 MR 包含新特性的提交,且该提交不带有破坏性变更,并使用了 feat 作为提交类型。
  • 给新特性添加了单元测试。
  • 手动验证过新特性可以正常工作。

问题修复:

  • 本次 MR 包含问题修复的提交,且该提交不带有新特性或破坏性变更,并使用了 fix 作为提交类型。
  • 给问题修复添加了单元测试。
  • 手动验证过问题修复得到解决。

杂项工作:

即所有对下游使用者无任何影响、且没有必要显示在 CHANGELOG 中的改动,例如修改注释、测试用例、开发文档等:

  • 本次 MR 包含杂项工作的提交,且该提交不带有问题修复、新特性或破坏性变更,并使用了 chore, docs, test 等作为提交类型。

Summary by CodeRabbit

发行说明

  • 重构
    • 路由表示已改进为包含当前路由及其同级路由集合,提升路由关系表达一致性。
    • 优化了增量渲染与路由匹配逻辑,减少错误回退并提高渲染准确性与性能稳定性。
    • 更新了数据存储对新路由结构的支持,增强整体稳定性与可维护性。

@coderabbitai
Copy link

coderabbitai bot commented Nov 18, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

在 Renderer、DataStore 和 interfaces 模块中新增并导出了 RouteNode 类型;将多个内部/公共方法的 parentRoutes 参数从 RouteConf[] 改为 RouteNode[],并相应调整路由路径构造、遍历与增量渲染的匹配逻辑(包含新增的内部辅助函数 matchTargetRoute)。

Changes

Cohort / File(s) 变更摘要
接口定义
packages/runtime/src/internal/interfaces.ts
新增导出接口 RouteNoderoute: RouteConfroutes: RouteConf[](表示该路由及其所有有序兄弟路由)。
Renderer 相关
packages/runtime/src/internal/Renderer.ts
将多处函数签名中 parentRoutes: RouteConf[] 改为 parentRoutes: RouteNode[](包括 renderRoutesrenderBricksrenderBricklegacyRenderBrickrenderForEach 等);在构造路由路径时由 parentRoutes.concat(route) 改为 parentRoutes.concat({ route, routes });新增内部函数 matchTargetRoute(route, routes, homepage, pathname) 并在增量渲染与匹配判断处使用;相应调整从最后一个 RouteNode 解构 parentRoutepageSiblingRoutes 的逻辑和 bailout 条件。
DataStore / 数据层
packages/runtime/src/internal/data/DataStore.ts
在导入/导出类型中加入 RouteNode;将 define、私有 resolve 等处的 routePath 参数类型由 RouteConf[] 改为 RouteNode[];遍历 routePath 时改为解构(for (const { route } of routePath))并在 pending/routeMap/routeStackMap 更新处传递新的节点结构。

Estimated code review effort

🎯 3 (中等) | ⏱️ ~20 分钟

  • 重点复核 packages/runtime/src/internal/Renderer.ts 中新增的 matchTargetRoute 及其在增量渲染路径上的边界条件与短路(bailout)逻辑。
  • 检查 packages/runtime/src/internal/data/DataStore.ts 中对 routePath 解构遍历的所有调用点是否一致且未遗漏,特别是 pending/routeMap/routeStackMap 的更新处。
  • 验证签名从 RouteConf[]RouteNode[] 的变更在整个调用链中的类型一致性与导出/导入处的公开类型声明。

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning PR描述遵循仓库模板结构,包含依赖检查、提交信息检查等必需部分,但所有复选框都未勾选,缺少对工作内容的具体说明和对变更类型的明确分类。 请根据变更内容勾选适当的复选框(破坏性变更/新特性/问题修复/杂项工作),并补充简单描述说明具体工作内容和测试情况。
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确总结了主要改动:修复了路由兄弟节点匹配顺序问题,直接对应代码变更中引入的 matchTargetRoute 助手函数和 RouteNode 结构的改进。
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch steve/v3-sibling-routes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

This comment was marked as outdated.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/runtime/src/internal/Renderer.ts (1)

892-952: 增量子路由的匹配逻辑更严谨,但依赖 parentRoutes 非空约束

这一段增量渲染逻辑:

  • 先通过

    const { route: parentRoute, routes: pageSiblingRoutes } =
      parentRoutes[parentRoutes.length - 1];

    拿到当前页面层级的 route 与其 siblings,并把 pageSiblingRoutes 传给 performIncrementalRender

  • 在回调里对每一层 parentRoutes 调用 matchTargetRoute(route, routes, homepage, pathname),只在“该层中按 sibling 顺序首个命中的就是当前 route 且前后 URL 都满足这一点,并且最底层 parentRoute 的 params 没变”的情况下才认为可以进行增量渲染。

这样可以避免 sibling 顺序变化或被其他路由“抢先匹配”时依然错误地走增量路径,逻辑上更安全,符合“按同层顺序取首个命中路由”的语义。

需要注意的一点是,这里仍然假设在进入 slotConf.type === "routes" 分支时 parentRoutes.length > 0(否则解构会在运行时抛错)。这个假设看起来与旧版实现一致,但如果未来有调用方直接在“非路由上下文”里调用 renderBricks(..., parentRoutes = []) 并使用 routes 槽位,会触发这个问题。建议在调用侧保持不变的约束,或者在这里加一层防御(例如在 parentRoutes.length === 0 时直接跳过增量渲染逻辑)。

Also applies to: 955-987

🧹 Nitpick comments (1)
packages/runtime/src/internal/Renderer.ts (1)

1379-1399: matchTargetRoute 有效封装了兄弟路由首命中的查找逻辑

matchTargetRoute 在 siblings 列表上顺序调用 matchRoute,一旦命中就 break,仅当“首个命中的 sibling 恰好是当前 route”时才返回对应的 MatchResult。配合上层 parentRoutes.every 的判断,可以精确表达“上一次和这一次在每一层的首个命中的都是同一个 route”这一条件,避免遗漏 sibling 匹配顺序带来的边界情况,实现上简洁且易于复用,看起来没有问题。如果后续这段逻辑有更多使用场景,可以考虑加上显式返回类型(如 MatchResult | null)和简短注释,以便类型提示更清晰。

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 3ccc031 and 27fb02f.

📒 Files selected for processing (3)
  • packages/runtime/src/internal/Renderer.ts (9 hunks)
  • packages/runtime/src/internal/data/DataStore.ts (5 hunks)
  • packages/runtime/src/internal/interfaces.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: CodeQL analysis (javascript-typescript)
  • GitHub Check: build (20.x)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (3)
packages/runtime/src/internal/interfaces.ts (1)

207-211: RouteNode 类型设计清晰,便于在渲染和数据层共享路由上下文

RouteNode 同时携带当前 route 以及同层 routes,很好地抽象出了“路由 + 兄弟路由”的上下文,后续在渲染和 DataStore 中解构使用会更直观,语义也和注释保持一致,看起来没有问题。

packages/runtime/src/internal/data/DataStore.ts (1)

20-26: RouteNode 在线路由路径上的接入与原有行为保持一致

这里把 routePath 类型切到 RouteNode[],并在两处使用中通过 for (const { route } of routePath) 解构出实际的 RouteConf,继续用 routeMap / routeStackMapRouteConf 做 WeakMap key,整体语义与原来传 RouteConf[] 基本等价,同时为增量渲染那边需要的 sibling 信息留出了空间,看起来比较自然,没有发现行为上的回归风险。

Also applies to: 330-361, 414-581

packages/runtime/src/internal/Renderer.ts (1)

48-56: 将 parentRoutes 升级为 RouteNode[] 的改动整体自然且兼容现有调用

parentRoutesRouteConf[] 升级为 RouteNode[],并在 renderRoutes 中通过

const routePath = parentRoutes.concat({ route, routes });

构造新的路径,从而在后续递归和 DataStore 中既能拿到“当前 route”,又能拿到“该层所有 siblings”。函数签名与内部调用(renderRoutes/renderBricks/renderBrick/renderForEach)都已经同步更新,看起来数据流清晰、没有遗漏调用点,行为上与旧版保持一致的同时,为后面的增量匹配逻辑提供了更多上下文信息。

Also applies to: 98-108, 245-255, 282-292, 319-329, 1127-1138

@weareoutman weareoutman force-pushed the steve/v3-sibling-routes branch from 27fb02f to 605677f Compare November 18, 2025 02:22
@weareoutman weareoutman force-pushed the steve/v3-sibling-routes branch from 605677f to b64d8bd Compare November 18, 2025 02:25
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
packages/runtime/src/internal/Renderer.ts (1)

893-1005: 兄弟路由匹配顺序逻辑清晰,但 parentRoutes 非空是假定条件,建议显式约束或保护

这里通过 RouteNode 增强了增量子路由的匹配判断:

  • const { route: parentRoute } = parentRoutes[parentRoutes.length - 1]; 取当前父路由;

  • 在增量回调中,parentRoutes.every(({ route, routes }) => { ... }) 对父链每一层执行:

    let prevMatch: MatchResult | null = null;
    let newMatch: MatchResult | null = null;
    return (
      (prevMatch = matchTargetRoute(route, routes, homepage, prevLocation.pathname)) &&
      (newMatch = matchTargetRoute(route, routes, homepage, pathname)) &&
      (route !== parentRoute || isRouteParamsEqual(prevMatch.params, newMatch.params))
    );
  • 新增的 matchTargetRoute(route, routes, homepage, pathname) 会在 siblings 中按顺序找到第一个匹配的路由

    • 若首匹配 === 当前 route,返回对应 MatchResult
    • 否则返回 null,表示“虽然有匹配,但当前 route 已经被前面的 sibling 抢占”,从而阻止增量渲染。

这很好地满足了“按兄弟路由顺序处理匹配”的需求,只有在“父链上每一层的目标路由都仍然是其 siblings 中的首个匹配,且最底层父路由的参数未变”时才执行增量渲染。

需要注意的一点:

  • const { route: parentRoute } = parentRoutes[parentRoutes.length - 1]; 隐含假设 parentRoutes.length > 0。从当前调用链(renderRoutes 自顶向下构造 routePath 并传递)来看,这个条件成立,但如果未来有新的调用方(例如测试或内部工具)以空数组调用 renderBrick/legacyRenderBrick 并触发路由 slot 分支,这里会在运行时抛错。

建议:

  • 要么在进入路由 slot 分支前加一个早期保护,例如:

    if (!parentRoutes.length) {
      // 理论上不应发生,可以视情况选择直接返回 lastOutput 或抛出更明确的错误
      return lastOutput;
    }
  • 要么在 API 文档/类型注释上明确规定:只有在存在至少一层已匹配路由时才允许传入 parentRoutes(例如通过调用侧断言)。

这样可以把当前实现依赖的前置条件表达得更清楚,减少后续维护时的踩坑概率。

Also applies to: 916-943, 1391-1408

🧹 Nitpick comments (1)
packages/runtime/src/internal/Renderer.ts (1)

932-943: matchTargetRoute 实现符合“首个匹配”的语义,便于后续复用

matchTargetRoute 把原先散落在增量逻辑中的“在 siblings 中找第一个匹配路由”的模式抽成了独立函数:

function matchTargetRoute(
  route: RouteConf,
  routes: RouteConf[],
  homepage: string,
  pathname: string
) {
  for (const sibling of routes) {
    const match = matchRoute(sibling, homepage, pathname);
    if (match) {
      return sibling === route ? match : null;
    }
  }
  return null;
}

优点:

  • 语义更清晰,显式体现“首个匹配路由必须是传入的 route 本身,否则认为不匹配”的策略;
  • 与上方 parentRoutes.every(...) 的使用方式契合,能很好地表达“父链上每层的路由在新旧 URL 上都没有被其他 sibling 抢占”的约束。

如果后续还有其他地方需要以 siblings 顺序判断“目标 route 是否仍是首个匹配”,建议也统一调用该 helper,避免重复实现。

Also applies to: 1391-1408

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 27fb02f and 605677f.

📒 Files selected for processing (3)
  • packages/runtime/src/internal/Renderer.ts (9 hunks)
  • packages/runtime/src/internal/data/DataStore.ts (5 hunks)
  • packages/runtime/src/internal/interfaces.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/runtime/src/internal/interfaces.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build (20.x)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
packages/runtime/src/internal/data/DataStore.ts (1)

20-25: RouteNode 引入与 routePath 解构用法整体合理,行为与旧实现一致

这里将 routePathRouteConf[] 升级为 RouteNode[],在两处使用中都通过

for (const { route } of routePath) { ... }

只取 route 字段来更新 routeMap / routeStackMap,与原先直接遍历 RouteConf[] 的逻辑等价,因此:

  • disposeDataInRoutes(routes: RouteConf[]) 依旧只依赖路由对象本身,不受 routes(兄弟集合)字段影响;
  • mountAsyncData(route?: RouteConf) 仍按单个路由键查询 routeMap,与新结构兼容;
  • resolve 上的 routePath?: RouteNode[] 参数虽然目前未使用,但调用方(如 Renderer.renderRoutes)已经传入了完整的 RouteNode 路径,为后续在数据解析阶段利用兄弟路由信息预留了空间。

从 DataStore 视角看,这次改动没有引入行为改变,看起来可以接受。

Also applies to: 330-360, 414-420, 568-577

packages/runtime/src/internal/Renderer.ts (1)

48-56: parentRoutes 统一使用 RouteNode[] 的改动与上下文一致

本文件中所有 parentRoutes 参数统一改为 RouteNode[],并在 renderRoutes 中通过

const routePath = parentRoutes.concat({ route, routes });

构造每一层的 RouteNode(携带当前匹配 route 及其同级 routes),然后一路向下传递到 renderBricks / renderBrick / legacyRenderBrick / renderForEach,以及 ctxStore.define

这样:

  • 每一层路由的“当前匹配 + 兄弟列表”都保存在 parentRoutes 链中,为后续增量渲染时的父链校验提供了足够上下文;
  • DataStore 侧只解构其中的 route 字段,依旧以 RouteConf 作为 key,不影响既有数据回收与 async 挂载逻辑。

整体类型与数据流更新是自洽的,看不出明显回归风险。

Also applies to: 98-108, 245-255, 282-292, 319-329, 1140-1151

@codecov
Copy link

codecov bot commented Nov 18, 2025

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.16%. Comparing base (3ccc031) to head (b64d8bd).
⚠️ Report is 3 commits behind head on v3.

Files with missing lines Patch % Lines
packages/runtime/src/internal/Renderer.ts 92.30% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##               v3    #4825      +/-   ##
==========================================
- Coverage   95.17%   95.16%   -0.01%     
==========================================
  Files         212      212              
  Lines        9348     9357       +9     
  Branches     1800     1802       +2     
==========================================
+ Hits         8897     8905       +8     
- Misses        331      332       +1     
  Partials      120      120              
Files with missing lines Coverage Δ
packages/runtime/src/internal/data/DataStore.ts 98.14% <100.00%> (ø)
packages/runtime/src/internal/Renderer.ts 93.70% <92.30%> (-0.12%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cypress
Copy link

cypress bot commented Nov 18, 2025

next-core    Run #11820

Run Properties:  status check passed Passed #11820  •  git commit b5ff229317 ℹ️: Merge b64d8bdfadc18bd7d37bc721d2bd866d91764f48 into 3ccc031c4b5cda5071a24b534d34...
Project next-core
Branch Review steve/v3-sibling-routes
Run status status check passed Passed #11820
Run duration 00m 22s
Commit git commit b5ff229317 ℹ️: Merge b64d8bdfadc18bd7d37bc721d2bd866d91764f48 into 3ccc031c4b5cda5071a24b534d34...
Committer Shenwei Wang
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 17
View all changes introduced in this branch ↗︎

@weareoutman weareoutman merged commit 783e29c into v3 Nov 18, 2025
10 of 12 checks passed
@weareoutman weareoutman deleted the steve/v3-sibling-routes branch November 18, 2025 02:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
packages/runtime/src/internal/Renderer.ts (1)

892-953: 增量子路由匹配逻辑基本正确,但建议增强边界防御与注释说明

  • 新增的 matchTargetRoute 通过在兄弟数组中按顺序调用 matchRoute,并仅在“首个匹配刚好是目标 route”时返回结果,可以修正之前忽略兄弟优先级的问题,逻辑上符合“按 storyboard 中 siblings 顺序匹配”的意图。

  • 回调中对父路由链的校验:

    const { route: parentRoute } = parentRoutes[parentRoutes.length - 1];
    ...
    parentRoutes.every(({ route, routes }) => {
      let prevMatch: MatchResult | null = null;
      let newMatch: MatchResult | null = null;
      return (
        (prevMatch = matchTargetRoute(...prevLocation.pathname)) &&
        (newMatch = matchTargetRoute(...pathname)) &&
        (route !== parentRoute || isRouteParamsEqual(prevMatch.params, newMatch.params))
      );
    });

    能确保:

    • 新旧 location 下每一层父路由在同一 siblings 集合中仍是“首个匹配”的路由;
    • 对最外层启用 incrementalSubRoutes 的那一层,还会比对 params(通过 isRouteParamsEqual)以避免参数变化时错误增量。

    这与 PR 标题“处理兄弟路由匹配顺序”相符。

  • 有两个小的防御性点可以考虑(其中第一个与已有评论重复):

    1. 这里直接解构 parentRoutes[parentRoutes.length - 1],假定 parentRoutes 至少有一个元素。从 v3 的使用约定来看,routes 型 slot 通常只出现在 route 树内部,确实应该有父路由;但为了防止未来调用方误传空数组,建议在进入这段逻辑前加一个显式判断(例如 if (!parentRoutes.length) return routesOutput; 或提前 return),既能消除潜在运行时错误,也能让意图更清晰。
    2. 回调体中访问 prevLocation.pathname,依赖 rendererContext.performIncrementalRender 始终传入非空的 prevLocation。如果该约定没有在类型或实现里严格保证,可以考虑在回调入口做一次防御性校验(例如若 !prevLocation 则直接返回 false),避免未来改动导致 NPE。
  • 另外,matchTargetRoute 本身依赖“第二个参数 routes 必须是完整兄弟集合且顺序与 storyboard 一致”,建议在函数注释中补一句这点约束,方便读者快速理解它与普通 matchRoute 的差别。

整体上,这段增量渲染逻辑方向正确,建议仅补充上述边界防御和文档说明即可。

Also applies to: 975-1004, 1040-1050, 1378-1396

🧹 Nitpick comments (1)
packages/runtime/src/internal/data/DataStore.ts (1)

20-25: RouteNode 路径改造与现有 routeMap/routeStackMap 兼容良好

这里将 routePathRouteConf[] 升级为 RouteNode[],但在内部仍通过解构 { route } 来使用,routeMap / routeStackMap 继续以 RouteConf 作为 WeakMap 键,disposeDataInRoutes 的行为也保持不变,看起来是无损改造。

可以考虑在 define/resolve 的注释或类型文档中明确说明 routePath 的语义(例如“从根到当前路由的链,每个节点携带该层所有兄弟 routes”),方便后续维护者理解这一结构。

Also applies to: 330-335, 349-357, 414-420, 568-576

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 605677f and b64d8bd.

📒 Files selected for processing (3)
  • packages/runtime/src/internal/Renderer.ts (9 hunks)
  • packages/runtime/src/internal/data/DataStore.ts (5 hunks)
  • packages/runtime/src/internal/interfaces.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: codecov/patch
  • GitHub Check: Agent
  • GitHub Check: build (20.x)
🔇 Additional comments (2)
packages/runtime/src/internal/interfaces.ts (1)

207-210: RouteNode 类型设计清晰,契合后续使用场景

route 与同层兄弟路由集合 routes 的拆分非常直观,能很好支撑 Renderer/DataStore 中对“路由链 + 兄弟列表”的建模,目前看没有语义或类型问题。

packages/runtime/src/internal/Renderer.ts (1)

48-56: parentRoutes 改为 RouteNode[] 的整体改造结构合理

  • 几个渲染入口统一将 parentRoutesRouteConf[] 升级为 RouteNode[],调用链始终沿用这一新结构,类型一致性良好。
  • renderRoutes 中通过 const routePath = parentRoutes.concat({ route, routes }) 构造“从根到当前路由”的节点链,随后传给 ctxStore.define,与 DataStore 中基于 RouteNode 的 routePath 使用方式保持对齐。
  • 下游的 renderBricks/renderBrick/renderForEach 均透传 parentRoutes,保证在子树(尤其是增量子路由)中可以获知完整路由链和兄弟集合。

整体看,这部分纯粹是结构升级,没有改变原有控制流,属于比较稳妥的重构。

Also applies to: 98-108, 245-255, 283-292, 319-329, 1126-1137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants