Skip to content

Fix node button reactivity by using Praxis store dispatch#25

Merged
kayodebristol merged 4 commits intomainfrom
copilot/fix-node-buttons-functionality
Jan 26, 2026
Merged

Fix node button reactivity by using Praxis store dispatch#25
kayodebristol merged 4 commits intomainfrom
copilot/fix-node-buttons-functionality

Conversation

Copy link
Contributor

Copilot AI commented Jan 25, 2026

  • Identify the root cause of node buttons not working
  • Fix reactivity in canvas-praxis.ts by using spread operator for array updates
  • Use praxisStore.dispatch() to properly notify subscribers
  • Ensure single store instance is used across modules
  • Remove debug logging
  • Fix missing canvasEngine import
  • Test that Terminal node button works
  • Test other node buttons (Input, Display, Transform)
  • Run existing tests to ensure no regressions (81 tests pass)
  • Run code review (no issues found)
  • Run security scan (no vulnerabilities found)
  • Address code review feedback: rename praxisStoreInternal to canvasPraxisStoreInstance
  • Address code review feedback: remove unused imports from canvas.ts
Original prompt

This section details on the original issue you should resolve

<issue_title>Add node buttons didn't work</issue_title>
<issue_description>None of the node type buttons worked. </issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 25, 2026 18:38
Fixed the issue where add node buttons didn't work by:
1. Using spread operator instead of push() for immutable updates
2. Using praxisStore.dispatch() instead of canvasEngine.step()
3. Ensuring single praxisStore instance is shared across modules

Co-authored-by: kayodebristol <3579196+kayodebristol@users.noreply.github.com>
Co-authored-by: kayodebristol <3579196+kayodebristol@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix node buttons not working issue Fix node button reactivity by using Praxis store dispatch Jan 25, 2026
Copilot AI requested a review from kayodebristol January 25, 2026 18:46
@kayodebristol kayodebristol requested review from Copilot and removed request for kayodebristol January 25, 2026 21:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes non-reactive node toolbar buttons by ensuring canvas updates go through the Praxis Svelte store so subscribers are notified consistently.

Changes:

  • Route all canvas actions through praxisStoreInternal.dispatch() instead of calling canvasEngine.step() directly.
  • Update add-node / add-connection rules to use immutable array reassignment to support reactivity.
  • Reuse a single Praxis store instance from canvas-praxis.ts in canvas.ts to avoid duplicate store instances.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/lib/stores/canvas.ts Reuses the shared Praxis store instance instead of creating a second store.
src/lib/stores/canvas-praxis.ts Adds exported store instance and switches actions/rules to patterns that trigger subscriber updates.

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

Comment on lines 4 to 5
import { canvasPraxisStore, praxisStoreInternal, canvasEngine, type CanvasContext } from './canvas-praxis';
import type { Canvas, CanvasNode, Connection } from '../types/canvas';
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

CanvasContext and CanvasNode are imported but no longer used in this module after switching to praxisStoreInternal. If svelte-check/TS noUnusedLocals is enabled (common in SvelteKit), this will fail the check step. Remove the unused imports or use them for explicit typing where needed.

Suggested change
import { canvasPraxisStore, praxisStoreInternal, canvasEngine, type CanvasContext } from './canvas-praxis';
import type { Canvas, CanvasNode, Connection } from '../types/canvas';
import { canvasPraxisStore, praxisStoreInternal, canvasEngine } from './canvas-praxis';
import type { Canvas, Connection } from '../types/canvas';

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed unused CanvasContext and CanvasNode type imports in commit 6fceead.

@kayodebristol
Copy link
Contributor

@copilot apply changes based on the comments in this thread

…used imports

- Renamed praxisStoreInternal to canvasPraxisStoreInstance to avoid implying it's a private/internal API
- Removed unused CanvasContext and CanvasNode type imports from canvas.ts
- All tests pass (81 tests)
- No TypeScript errors

Co-authored-by: kayodebristol <3579196+kayodebristol@users.noreply.github.com>
Copilot AI requested a review from kayodebristol January 26, 2026 04:17
@kayodebristol kayodebristol marked this pull request as ready for review January 26, 2026 04:39
@kayodebristol
Copy link
Contributor

@copilot apply changes based on the comments in this thread

Copy link
Contributor Author

Copilot AI commented Jan 26, 2026

@copilot apply changes based on the comments in this thread

All changes from the code review have already been applied in commit 6fceead:

  • Renamed praxisStoreInternal to canvasPraxisStoreInstance
  • Removed unused CanvasContext and CanvasNode type imports from canvas.ts

All tests pass (81 tests) and there are no TypeScript errors.

@kayodebristol kayodebristol merged commit 7c29e6a into main Jan 26, 2026
6 checks passed
@kayodebristol kayodebristol deleted the copilot/fix-node-buttons-functionality branch January 26, 2026 04:46
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.

Add node buttons didn't work

2 participants