Skip to content

feat(web): locate workflow nodes by node_id in the workflow editor #38184

Description

@ruanimal

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

Background

In real-world operations, when a workflow run fails, operators typically identify the failing node's node_id from server logs (e.g., a code node execution error). They then need to return to the workflow editor and find the corresponding node on the canvas for troubleshooting and fixes.

The current workflow editor has the following limitations:

  1. Cmd+K search only matches by node title/type/description — it does not support searching by node_id. Operators usually have the node_id from logs, not the node title, so they cannot search and locate the node directly.
  2. No URL-based node navigation — operators cannot construct a link that opens the editor and automatically navigates to a specific node. They must manually find it on the canvas.

Requirements

Provide two ways for operators to quickly locate a workflow node by node_id:

  1. Cmd+K search supports node_id matching — in the goto-anything search @node mode, include node_id in the search scope and display it in the search results.
  2. URL parameter ?node_id=xxx for direct navigation — when opening a URL with the node_id query parameter, the editor automatically selects and scrolls to that node.

Solution

1. Cmd+K search supports node_id

Modified file: web/app/components/workflow/hooks/use-workflow-search.tsx

Changes:

  • Added a nodeId field to the searchableNodes mapping, exposing node.id to the search logic.
  • Added node_id matching rules to the calculateScore scoring function with the highest weight (exact match: 120 points > title exact prefix: 100 points), ensuring that when searching by node_id, the target node ranks first.
  • Appended node_id to the search result description, separated by · (e.g., Node description · 1721234567890), so users can confirm the matched node.

Scoring rules:

Match type Score Description
nodeId === searchTerm 120 Exact node_id match
nodeId.startsWith(searchTerm) 90 Prefix match
nodeId.includes(searchTerm) 40 Partial match

Usage:

Cmd+K → type @node → paste node_id → select result → node is selected and scrolled into view

2. URL parameter ?node_id=xxx for direct navigation

New file: web/app/components/workflow/hooks/use-locate-node.ts

Modified files:

  • web/app/components/workflow/index.tsx — call useLocateNode(nodes) in the Workflow component
  • web/i18n/en-US/workflow.json — added panel.locateNodeNotFound and panel.locateNodeSuccess
  • web/i18n/zh-Hans/workflow.json — added corresponding Chinese translations

Changes:

  • Added useLocateNode hook that reads the node_id query parameter from the URL.
  • Once workflow node data has loaded, it looks up the node by node_id:
    • Found: selects the node (automatically opens the right-side config panel) + scrolls the viewport to the node + shows a success toast.
    • Not found: shows an error toast with the specific node_id.
  • Uses useRef to ensure the locate action runs only once, preventing repeated triggers when node data changes.

Usage:

https://your-dify.com/app/{appId}/workflow?node_id=1721234567890

Opening this URL automatically selects and scrolls to the target node in the editor.

Known limitations

  • Both methods can only search/locate nodes that are currently rendered on the canvas. The canvas displays only one set of node data at a time (the latest draft or a specific historical run).
  • If the failing node has been deleted from the latest draft, the operator must first enter "Run History," switch to the run that contains the node, and then search.
  • Searching for a node_id across all historical runs requires a backend API and is out of scope for this change.

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions