Skip to content

Refactor of big Flow component - #610

Merged
Matthbo merged 15 commits into
masterfrom
issue/609-analyse-flow-component-useeffect-dependencies-create-sub-modules-or-hooks-for-complex-standalone-logic
Jul 30, 2026
Merged

Refactor of big Flow component#610
Matthbo merged 15 commits into
masterfrom
issue/609-analyse-flow-component-useeffect-dependencies-create-sub-modules-or-hooks-for-complex-standalone-logic

Conversation

@Matthbo

@Matthbo Matthbo commented Jul 14, 2026

Copy link
Copy Markdown
Member

No description provided.

@Matthbo
Matthbo marked this pull request as ready for review July 16, 2026 17:28
@Matthbo

Matthbo commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

It's still a buggy mess, but at least the code makes a lot more sense now.
Need more time to figure out when, what and why when it comes to loading and saving the file and improve upon that.
Looks like some useCallback functions also keep getting called each frame which is making the whole thing so laggy.
Ill make a new issue for these things so other people can at least work with what's done now

Comment thread src/main/frontend/app/routes/studio/canvas-flow/canvas-flow.tsx
Comment thread src/main/frontend/app/routes/studio/canvas-flow/canvas-flow.tsx
@Matthbo
Matthbo force-pushed the issue/609-analyse-flow-component-useeffect-dependencies-create-sub-modules-or-hooks-for-complex-standalone-logic branch from 6e14725 to e7b180e Compare July 22, 2026 14:56
@Matthbo

Matthbo commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

Oops didnt mean to forcepush, @stijnpotters1 was that the only feedback you have?
I'd love to work on part two of the refactor

@Matthbo

Matthbo commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

Waiting on #615 to be merged first

…-dependencies-create-sub-modules-or-hooks-for-complex-standalone-logic

# Conflicts:
#	src/main/frontend/app/routes/studio/canvas-flow/canvas-flow.tsx
#	src/main/frontend/app/routes/studio/canvas-flow/nodetypes/start-node.tsx
@Matthbo
Matthbo requested a review from stijnpotters1 July 24, 2026 17:07
Matthbo added 5 commits July 27, 2026 16:00
…-dependencies-create-sub-modules-or-hooks-for-complex-standalone-logic

# Conflicts:
#	pnpm-lock.yaml
#	src/main/frontend/app/routes/configurations/component-row.tsx
#	src/main/frontend/app/routes/editor/editor.tsx
#	src/main/frontend/app/routes/projectlanding/project-landing.tsx
#	src/main/frontend/app/routes/studio/canvas-flow/canvas-flow.tsx
#	src/main/frontend/app/routes/studio/canvas-flow/nodetypes/exit-node.tsx
#	src/main/frontend/app/routes/studio/canvas-flow/nodetypes/group-node.tsx
#	src/main/frontend/app/routes/studio/canvas-flow/nodetypes/sticky-note.tsx
#	src/main/frontend/app/routes/studio/canvas-flow/nodetypes/zoomed-out-node.tsx
#	src/main/frontend/app/routes/studio/context/group-context.tsx
#	src/main/frontend/app/routes/studio/studio.tsx
#	src/main/frontend/app/routes/studio/xml-to-json-parser.ts
#	src/main/frontend/package.json
@sonarqubecloud

Copy link
Copy Markdown

@philipsens philipsens left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice to see the right panel logic grouped in a new file.
I like the order of hooks, state, store, callback, memo etc. I wonder if there is any linting rule for this. I'd really like to enforce this kind of stuff, since the order in the frank-node could also be better. If not, it's just something to keep in mind, and maybe add to the front-end conventions.

It's a bit hard to review the logic itself since a lot has moved. but I don't see anything weird .

Adapters now open in the top left instead of in the middle and zoomed to fit. I think that is a bug.

Why is canvas renamed to canvas-flow? Was it so the component could be renamed to a more practical name?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the Studio “Flow” canvas by moving the implementation into a new canvas-flow/ area, extracting UI subcomponents (right panel, node UI pieces, handle menu, etc.), and updating related imports/usages across the frontend. It also updates frontend dependencies (React, react-router, xyflow, doc-library, pnpm) and tweaks the backend configurations endpoint status behavior.

Changes:

  • Refactor Studio flow canvas into routes/studio/canvas-flow/ with new node/edge components and shared UI building blocks.
  • Extract right panel rendering into a dedicated right-panel-content.tsx component and migrate context menu plumbing.
  • Update backend/frontend handling of /projects/configurations (client now tolerates 204 by returning undefined) and bump frontend dependency versions.

Reviewed changes

Copilot reviewed 26 out of 40 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/main/java/org/frankframework/flow/project/ConfigurationProjectController.java Adjusts /projects/configurations behavior when no cluster member target is present.
src/main/frontend/package.json Dependency/version bumps and pnpm packageManager update; removes dotenv dependency.
src/main/frontend/app/utils/xsd-utils.ts Updates imports and refactors XSD element extraction to pass Document through recursion.
src/main/frontend/app/utils/flow-utils.ts Updates FlowNode type import to new canvas-flow location.
src/main/frontend/app/stores/flow-store.ts Updates imports to new canvas-flow node/edge/type locations.
src/main/frontend/app/stores/child-utilities.ts Updates ChildNode type import to new canvas-flow location.
src/main/frontend/app/services/frank-framework-service.ts Changes return type to allow undefined when API returns 204/no body.
src/main/frontend/app/routes/studio/xml-to-json-parser.ts Updates Flow-related type imports to canvas-flow.
src/main/frontend/app/routes/studio/studio.tsx Switches Studio to render FlowCanvas with ReactFlowProvider and extracted right panel content.
src/main/frontend/app/routes/studio/right-panel-content.tsx New component containing the extracted right panel logic from studio.tsx.
src/main/frontend/app/routes/studio/flow-to-xml-parser.ts Updates Flow-related type imports to canvas-flow.
src/main/frontend/app/routes/studio/context/sticky-note-context.tsx Updates imports to canvas-flow node types/constants.
src/main/frontend/app/routes/studio/context/group-context.tsx Updates imports to canvas-flow node types/constants.
src/main/frontend/app/routes/studio/context/context-input.tsx Updates DeprecatedPopover import to new canvas-flow component location.
src/main/frontend/app/routes/studio/canvas-flow/nodetypes/zoomed-out-node.tsx Updates FlowConfig import path to canvas-flow.
src/main/frontend/app/routes/studio/canvas-flow/nodetypes/sticky-note.tsx Updates FlowConfig/ResizeIcon/context-menu imports to canvas-flow.
src/main/frontend/app/routes/studio/canvas-flow/nodetypes/group-node.tsx Updates ResizeIcon import to canvas-flow.
src/main/frontend/app/routes/studio/canvas-flow/nodetypes/frank-node.tsx Updates handle/config/context-menu imports to canvas-flow.
src/main/frontend/app/routes/studio/canvas-flow/nodetypes/exit-node.tsx Updates ResizeIcon/FlowConfig imports to canvas-flow.
src/main/frontend/app/routes/studio/canvas-flow/nodetypes/components/node-header.tsx New shared node header (colored title bar) component.
src/main/frontend/app/routes/studio/canvas-flow/nodetypes/components/node-children-container.tsx New shared container styling for nested node children.
src/main/frontend/app/routes/studio/canvas-flow/nodetypes/components/missing-requirements.tsx New UI for displaying missing mandatory children requirements.
src/main/frontend/app/routes/studio/canvas-flow/nodetypes/components/handle.tsx New custom source handle implementation with menu support.
src/main/frontend/app/routes/studio/canvas-flow/nodetypes/components/handle-menu.tsx New portal-based handle type selection menu.
src/main/frontend/app/routes/studio/canvas-flow/nodetypes/components/handle-menu-item.tsx New menu item component for handle menu entries.
src/main/frontend/app/routes/studio/canvas-flow/nodetypes/components/deprecated-popover.tsx New portal-based deprecated popover used by context input UI.
src/main/frontend/app/routes/studio/canvas-flow/nodetypes/child-node.tsx New nested child node rendering + drag/drop child creation support.
src/main/frontend/app/routes/studio/canvas-flow/nodes.ts New initial node data source for the canvas-flow implementation.
src/main/frontend/app/routes/studio/canvas-flow/node-context-menu-context.ts New context provider/hook for toggling the node context menu from within canvas-flow components.
src/main/frontend/app/routes/studio/canvas-flow/flow.config.ts New FlowConfig location plus compact-label scaling helper.
src/main/frontend/app/routes/studio/canvas-flow/edgetypes/frank-edge.tsx Updates FlowConfig import path to canvas-flow.
src/main/frontend/app/routes/studio/canvas-flow/edgetypes/edge-label.tsx New edge label renderer component (with delete affordance).
src/main/frontend/app/routes/studio/canvas-flow/edges.ts New initial edges data source for the canvas-flow implementation.
src/main/frontend/app/routes/studio/canvas-flow/canvas-flow.tsx Large refactor of the main canvas implementation (state mgmt, autosave/load, layout, grouping, edge drop, etc.).
src/main/frontend/app/routes/projectlanding/project-landing.tsx Adds guard for possibly-undefined FFInstance due to 204/no body behavior.
src/main/frontend/app/main.tsx Removes dotenv initialization from frontend entrypoint.
src/main/frontend/app/components/sidebars-layout/sidebar-layout-store.ts Tightens function return types and fixes visibility toggle logic.
src/main/frontend/app/components/flow/create-node-modal.tsx Updates FlowNode import to canvas-flow.
src/main/frontend/app/components/file-structure/use-file-tree-context-menu.ts Fixes useCallback dependency list to include logApiError.
pnpm-lock.yaml Lockfile updates corresponding to dependency bumps and removal of dotenv.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (2)

src/main/frontend/app/routes/studio/canvas-flow/canvas-flow.tsx:620

  • saveFlow() throws if the adapter can’t be found (or if XML parsing failed and allAdapters is empty) outside the try/catch that sets the save status back to idle. This can bubble up as an unhandled rejection and leave the UI stuck in the "saving" state.
    src/main/frontend/app/routes/studio/canvas-flow/canvas-flow.tsx:1494
  • There is a useCallback(...) hook invocation whose return value is discarded (it’s not assigned to a variable and not called). This adds a hook call with no effect and looks like leftover refactor code; it should either be removed or wired into the code path that needs it.

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

@Matthbo

Matthbo commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

I'd really like to enforce this kind of stuff, since the order in the frank-node could also be better. If not, it's just something to keep in mind, and maybe add to the front-end conventions.

Would be very nice, though I think it doesnt exist in the form how we like it to be

Adapters now open in the top left instead of in the middle and zoomed to fit. I think that is a bug.

There are more bugs, a new issue has been made to go over the loading and saving logic again since I feel like its done pretty badly still, I also am working on an issue to improve the flow-store so that should also hopefully improve a lot and maybe offload some things from the canvas-flow component

Why is canvas renamed to canvas-flow? Was it so the component could be renamed to a more practical name?

More descriptive and makes it so its not easy to be confused with the whole project when just saying its name. Mostly fits nicely with what already existed as well

@Matthbo
Matthbo enabled auto-merge (squash) July 29, 2026 14:27
@Matthbo
Matthbo merged commit 369b6f1 into master Jul 30, 2026
6 checks passed
@Matthbo
Matthbo deleted the issue/609-analyse-flow-component-useeffect-dependencies-create-sub-modules-or-hooks-for-complex-standalone-logic branch July 30, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Analyse Flow component useEffect dependencies & create sub modules or hooks for complex standalone logic 204 instead of 404 for no members

4 participants