Skip to content

Fix 'Add to Stack' button showing for technologies already in the stack#4

Open
stackedsax wants to merge 1 commit into
mainfrom
fix/add-to-stack-button
Open

Fix 'Add to Stack' button showing for technologies already in the stack#4
stackedsax wants to merge 1 commit into
mainfrom
fix/add-to-stack-button

Conversation

@stackedsax

Copy link
Copy Markdown
Contributor

Summary

  • isAlreadyAdded was only checking currentStack.technologies[selectedStage], so clicking a technology directly from the canvas (where no stage is selected in the left panel) always showed the Add to Stack button — even if the technology was already in the stack somewhere

  • Fix: check across all stages with Object.values(currentStack.technologies).flat()

Test plan

  • Add a technology to a stage
  • Click that technology on the canvas — modal should show Remove from Stack, not Add to Stack
  • Click a technology not yet in the stack — modal should show Add to Stack

🤖 Generated with Claude Code

isAlreadyAdded was only checking the currently selected stage, so
clicking a technology from the canvas (where no stage is selected in
the panel) always showed the Add button even if the tech was already
in the stack. Now checks across all stages.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@netlify

netlify Bot commented May 27, 2026

Copy link
Copy Markdown

Deploy Preview for mlops-studio ready!

Name Link
🔨 Latest commit a47b1d3
🔍 Latest deploy log https://app.netlify.com/projects/mlops-studio/deploys/6a175e9d81aeff00085839b9
😎 Deploy Preview https://deploy-preview-4--mlops-studio.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown

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 updates the stack builder modal state so technologies already present in any stage are recognized as already added, addressing the incorrect Add to Stack button when opening a technology from the canvas.

Changes:

  • Replaces the selected-stage-only membership check with a stack-wide check across all stage technology arrays.
  • Keeps the resulting isAlreadyAdded value wired into TechnologyModal.

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

Comment thread src/app/page.tsx
Comment on lines +179 to +183
const isAlreadyAdded = selectedTechnology
? Object.values(currentStack.technologies)
.flat()
.some(t => t.id === selectedTechnology.id)
: false
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.

2 participants