-
Notifications
You must be signed in to change notification settings - Fork 3.6k
improvement(workflow-panel): header tooltips, search shortcut hint, URL-driven active tab #4523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: staging
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,12 +1,15 @@ | ||||||||||||||||||||||
| import { useCallback, useMemo } from 'react' | ||||||||||||||||||||||
| import { parseAsStringLiteral, useQueryState } from 'nuqs' | ||||||||||||||||||||||
| import { useBlockState } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/hooks' | ||||||||||||||||||||||
| import type { WorkflowBlockProps } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/types' | ||||||||||||||||||||||
| import { useCurrentWorkflow } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-current-workflow' | ||||||||||||||||||||||
| import { getBlockRingStyles } from '@/app/workspace/[workspaceId]/w/[workflowId]/utils/block-ring-utils' | ||||||||||||||||||||||
| import { useLastRunPath } from '@/stores/execution' | ||||||||||||||||||||||
| import { usePanelEditorStore, usePanelStore } from '@/stores/panel' | ||||||||||||||||||||||
| import { usePanelEditorStore } from '@/stores/panel' | ||||||||||||||||||||||
| import { useWorkflowRegistry } from '@/stores/workflows/registry/store' | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| const PANEL_TABS = ['copilot', 'toolbar', 'editor'] as const | ||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicated
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Props for the useBlockVisual hook. | ||||||||||||||||||||||
|
Comment on lines
+11
to
14
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The same
Suggested change
|
||||||||||||||||||||||
| */ | ||||||||||||||||||||||
|
|
@@ -54,16 +57,8 @@ export function useBlockVisual({ | |||||||||||||||||||||
| const currentBlockId = usePanelEditorStore((state) => state.currentBlockId) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| const isThisBlockInEditor = currentBlockId === blockId | ||||||||||||||||||||||
| const activeTabIsEditor = usePanelStore( | ||||||||||||||||||||||
| useCallback( | ||||||||||||||||||||||
| (state) => { | ||||||||||||||||||||||
| if (isPreview || isEmbedded || !isThisBlockInEditor) return false | ||||||||||||||||||||||
| return state.activeTab === 'editor' | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| [isPreview, isEmbedded, isThisBlockInEditor] | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
| const isEditorOpen = !isPreview && !isEmbedded && isThisBlockInEditor && activeTabIsEditor | ||||||||||||||||||||||
| const [panelTab] = useQueryState('panel', parseAsStringLiteral(PANEL_TABS).withDefault('copilot')) | ||||||||||||||||||||||
| const isEditorOpen = !isPreview && !isEmbedded && isThisBlockInEditor && panelTab === 'editor' | ||||||||||||||||||||||
|
Comment on lines
+60
to
+61
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| const lastRunPath = useLastRunPath() | ||||||||||||||||||||||
| const runPathStatus = isPreview ? undefined : lastRunPath.get(blockId) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
panel:set-tabevent is fire-and-forget — missed events leave the tab unchangedrequestEditorTab()dispatches a synchronousCustomEventonwindow, and the Panel only processes it while mounted with an active listener. If the Panel is mid-unmount/remount (e.g. during a fast route transition followed by an immediate block click), the event fires into a gap where no listener is registered and the URL never updates — the editor tab silently fails to open. A safety net like checkingactiveTabafter a microtask, or using a small shared atom/signal instead of a one-shot event, would make the bridge more resilient.