[Refactor/Chore] Audit workflow and RAG pipeline static loading boundaries

未关闭
#42,437 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
45/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript, vite

调研方向

Start with web/app/components/workflow/header/index.tsx, web/app/components/workflow-app/index.tsx, and web/app/components/rag-pipeline/components/panel/test-run/index.tsx. Reproduce the static dependency graph and measure production loading for workflow editing, pipeline editing, and snippets, tracing concrete eager import chains and existing dynamic imports. Done means justified boundaries with preserved editing, run/debug, history/restore, CRDT, and ELK behavior, plus before/after transferred JavaScript and request measurements.

由索引模型根据 Issue 内容生成。

描述

project#dify
Self Checks
  • I have read the Contributing Guide and Language Policy.
  • This is only for refactors or chores; questions belong in Discussions.
  • I have searched for existing issues, including closed ones.
  • I confirm that I am using English to submit this report.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • I have filled in the required template fields.
Description

Audit the client loading boundaries shared by workflow editing, RAG pipeline editing and snippets. A local Rolldown build produced a workflow-related shared header chunk of 1,143,158 bytes (about 294,139 bytes gzip), containing 579 project modules as well as third-party modules. Following its static manifest imports yields 379 JS files / 7.14 MB / approximately 2.11 MB gzip.

The chunk is statically referenced from workflow-app, the dataset pipeline page, several RAG pipeline panels, snippets, and workflow panels. Its generated name is not evidence that one header component alone is responsible.

Starting points:

This is an investigation/refactor task, not a confirmed claim that all of these bytes are unnecessary or fetched on every page. Identify which infrequently opened panels or feature dependencies are reachable statically, then choose boundaries based on actual route usage.

Motivation

A broad shared static dependency graph can cause workflows and pipeline surfaces to load functionality before it is needed. Measure route-level production requests before deciding which boundaries to change.

Acceptance criteria:

  • Reproduce the graph and record per-route production loading for workflow editing, pipeline editing and snippets.
  • Identify concrete eager import chains to optional functionality; defer only features that do not need to participate in initial rendering.
  • Preserve editing, run/debug, history/restore and shared state behavior. Existing history/restore wrappers already use dynamic imports, so confirm transitive reachability rather than assuming they are entirely eager.
  • Report before/after transferred JS and request behavior. Renaming chunks or increasing file count alone is not success.
  • Keep already-lazy CRDT runtime and ELK loading lazy; their large chunks are not included merely because they exist in the output.
Additional Context

Measurements come from a local Dify 1.17.1 development checkout (base commit 06e473015a9a1abb71da88ac0a0e92d96a992008, with local DevTools integration patches), using Vinext 1.0.0-beta.10 / Vite+ core 0.3.2 / Node 24.21.0. They are a diagnostic baseline, not a benchmark of an unmodified main checkout or a production network measurement. Related background: #30931 (closed).

Static dependency totals below follow manifest imports recursively, deduplicate files, and exclude dynamic imports, CSS, images and fonts. Gzip values are summed per-file estimates. Shared closures overlap and must not be added together.

主要语言
TypeScript
星标
157k
派生
24.7k
平均合并
22 小时 32 分钟
30 天内合并 PR
611

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

langgenius/dify 的其他 Issue

查看 langgenius/dify 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。