Conversation
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughThis pull request modifies the thumbnail utility to introduce stricter typing for node collections. The public Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/utils/thumbnail.ts (1)
380-392: LGTM! Clean extraction of node transformation logic.The helper function correctly transforms raw nodes into
NodeThumbnail[], with proper handling of edge cases.♻️ Optional: Consider refactoring `_getFlowThumbnail` to use this helper
The logic in
_getFlowThumbnail(lines 361-369) duplicates this helper's functionality. You could reduce duplication:private async _getFlowThumbnail(flowData: FlowLikeData): Promise<FlowThumbnail | undefined> { - const nodes: NodeThumbnail[] = []; - for (const nodeManifest of flowData.data.nodes || []) { - if (nodeManifest?.node_id) { - const node = await this._getNodeThumbnail(nodeManifest, flowData); - if (node) { - nodes.push(node); - } - } - } + const nodes = await this._getNodesThumbnail(flowData.data.nodes, flowData); return { name: flowData.manifestName, title: this.wsPkgData.localize(flowData.title),Note:
_getFlowThumbnailhas an additionalnodeManifest?.node_idcheck that_getNodesThumbnaildoesn't have. You'd need to verify whether that check is necessary or if it's redundant.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/utils/thumbnail.ts
🔇 Additional comments (2)
src/utils/thumbnail.ts (2)
314-314: LGTM! Properly transforms subflow nodes.The change correctly uses the new helper function to transform raw nodes into
NodeThumbnail[], fixing the bug where subflow block nodes weren't being translated like flow nodes were.
32-32: Good type alignment with FlowThumbnail.This change makes
BlockThumbnail.nodesconsistent withFlowThumbnail.nodes(line 18), ensuring both useNodeThumbnail[]instead of rawNode[]. This properly transforms subflow block nodes via the new_getNodesThumbnailhelper (line 314).
业务上 block doc 会读这些 nodes 生成 slot 文档,但是云函数并不能传 slot(可以从 UI 上过滤掉),所以影响不大。