Skip to content

Conversation

@krishna9358
Copy link
Contributor

Summary

  • Fix spotlight component placement not responding to canvas clicks
  • Add workflow-scoped placement state to prevent cross-workflow interference
  • Improve UX with crosshair cursor during placement mode

Problem

  • When selecting a component from the spotlight (Cmd+K), the "Click to place" indicator wasn't appearing immediately, and clicking on the canvas didn't place the component. Additionally, the placement state was global, meaning selecting a component in one workflow would affect all open workflows.

Root Cause

  • No re-render on state change: The placement state was a plain JavaScript object instead of React state. When the Command Palette set the placement values, React didn't re-render the Canvas component, so the indicator wasn't visible.
  • Wrong click handler: The placement logic was in handleCanvasTap attached to an outer div, but ReactFlow captures all click events internally. The actual onPaneClick handler (which fires when clicking empty canvas space) only deselected nodes.
  • Global state: The placement was stored globally with no workflow scoping.

Fix

  • Converted sidebar-state.ts from a plain object to a Zustand store (usePlacementStore) for proper React reactivity
  • Added workflowId to placement state to scope placement to specific workflows
  • Integrated placement logic into ReactFlow's onPaneClick handler
  • Added crosshair cursor when placement mode is active for better visual feedback
  • Updated text from "Tap to place" to "Click to place" for desktop clarity

Testing

  • bun run test
  • bun run lint
  • bun run typecheck
  • Additional notes:

Documentation

  • Updated the relevant doc(s) (see docs/guide.md) or checked that no updates are needed.
  • Recorded contract/architecture changes in both public docs and .ai logs when applicable.

@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@LuD1161 LuD1161 merged commit e65458a into main Feb 1, 2026
3 checks passed
@LuD1161 LuD1161 deleted the @krishna9358/spotlight-ux-fix branch February 1, 2026 01:33
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.

3 participants