GitHub user CaroFernando added a comment to the discussion: Proposal: Ditch Angular and Switch to a new frontend framework
Ahead of the vote, I wanted to add data on two questions raised here: how hard it would be to migrate the editor and shared editing (@chenlica), and whether React holds up under Texera's real-time load (@Ma77Ball). Code and full results are on my fork: https://github.com/CaroFernando/texera/tree/proto/frontend-migration-landing/frontend-experiments **How I tested it:** - **Code audit:** I went through every frontend file involved in the editor and in shared editing and counted what is tied to Angular, to JointJS, or to neither. - **Benchmark:** the same workflow rendered by four canvases: - JointJS (what we use today, hosted in React) - React Flow - Svelte Flow - solid-flow - **Realistic session:** - Operators that mirror `joint-ui.service.ts` - A Yjs doc shaped like our `SharedModel`, with two co-editors sending updates from a Web Worker (as y-websocket would) - One execution sending statistics for every operator every 500 ms (our real interval) - The local user dragging and panning, on workflows of 30 to 300 operators - **Measurement:** - Headless Chrome with CPU throttling to emulate a mid-range laptop - Frame times, input blocking and memory - CPU profiles split into Yjs, framework, canvas library and rendering - Medians of 3 runs ## 1. Migrating shared editing and the editor - **The core of shared editing is already framework-neutral.** - Covered: `SharedModel`, `WorkflowGraph`, `SharedModelChangeHandler`, `WorkflowActionService`, co-editor presence, undo/redo and UDF parameter sync. - Together that's about 4,000 lines, with ~8 lines of Angular in total (`@Injectable` and the like). - This code can move to React almost unchanged. - **The canvas code carries over too if we keep JointJS,** which is what @aglinxinyuan's prototype (#9389) does. JointJS is framework-agnostic. `joint-ui.service.ts` and the graph wrapper (~2,200 lines) have no Angular, and the existing editor tests can verify the port. - **What has to be rebuilt is the Angular-bound UI around it.** About 2,800 lines: - The editor component and minimap (~2,400 more lines) - The collaborative property panel, built on ngx-formly with its own Yjs wrapper - The code editor and the comment box I think the property panel is the real hard part of migrating shared editing, more than the canvas or the Yjs layer. It needs a plan of its own. - **This fits the incremental approach @aglinxinyuan proposed (#9472):** keep JointJS, move the Yjs services as plain TypeScript, port the UI component by component, and treat any canvas change as a separate effort later. Write-up: https://github.com/CaroFernando/texera/blob/proto/frontend-migration-landing/frontend-experiments/EDITOR-MIGRATION.md ## 2. Performance under real-time load **Realistic session, mid-range machine (30 s session):** | | 100 operators | 300 operators | | --- | --- | --- | | JointJS as Texera runs it today | 38 fps, input blocked 9.7 s | 10 fps, statistics 24 s late | | JointJS with two fixes | 59 fps, no blocking | 56 fps, 0.5 s blocked | | React Flow | 60 fps | 60 fps, 5.8 s CPU | | Svelte Flow | 60 fps | 60 fps, 5.1 s CPU | | solid-flow | 60 fps | 57 fps, visible stutters, 10.7 s CPU | - **Real-time collaboration itself is cheap.** Yjs plus the canvas binding is under 5% of CPU in every case; redrawing operators is the cost. - **React's re-rendering was not the bottleneck.** React itself was 0.6 s of React Flow's 5.8 s of CPU at 300 operators. At realistic sizes React Flow also used less memory than Svelte Flow or solid-flow without culling. - **Svelte Flow was ~12% cheaper than React Flow,** not something users would notice. solid-flow was the weakest. - **Today's editor slowness comes from how we use JointJS, not from Angular.** We use a synchronous paper, and every 500 ms each operator is re-rendered three times for its statistics. Two fixes close most of the gap, and they can be applied today, independent of the migration: - Async rendering with culling - Writing statistics in one `attr()` call - Plus the `jointjs` → `@joint/core` 4 upgrade @zyratlo and @Xiao-zhen-Liu mentioned. Against our code it type-checks after a handful of small changes. Results: https://github.com/CaroFernando/texera/blob/proto/frontend-migration-landing/frontend-experiments/EDITOR-BENCHMARK.md ## 3. Ecosystem for what we build next To add to @kunwp1's and @zyratlo's point about community size and coding agents: it shows most clearly in agent features, which are where Texera is heading. Weekly npm downloads: | | React | Angular | | --- | --: | --: | | Framework | 274M | 8.5M | | Vercel AI SDK UI hooks | 14.3M | 39k | | CopilotKit | 811k | 23k | | assistant-ui | 3.5M | no Angular version | On Angular, more of the streaming chat, tool-call rendering and agent state UI would be built by hand. ## Conclusion The data supports moving to React: - **The real-time concern doesn't show up as a React cost.** - **The editor and the Yjs core carry over with low risk** if we keep JointJS and migrate incrementally. - **The ecosystem gap matters most for the agent features we plan to build.** - **The editor's current performance problem should be fixed now either way,** since it isn't caused by Angular. - **The collaborative property panel is the piece I'd plan most carefully.** Caveats: one emulated machine profile and a synthetic workflow layout; the JointJS fixes were measured in the benchmark, not yet in Texera; the property panel and code editor were audited, not prototyped. GitHub link: https://github.com/apache/texera/discussions/9387#discussioncomment-19771518 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected]
