Skip to content

fix: resolve missing toast import causing build failure#248

Open
vaishnavijha12 wants to merge 1 commit into
piyushdotcomm:mainfrom
vaishnavijha12:fix/missing-toast-import
Open

fix: resolve missing toast import causing build failure#248
vaishnavijha12 wants to merge 1 commit into
piyushdotcomm:mainfrom
vaishnavijha12:fix/missing-toast-import

Conversation

@vaishnavijha12
Copy link
Copy Markdown

@vaishnavijha12 vaishnavijha12 commented May 22, 2026

Summary

Added the missing toast import in modules/playground/components/package-manager.tsx to resolve TypeScript build errors.

Changes Made

  • Imported toast from sonner
  • Fixed TS2304: Cannot find name 'toast' errors in the package manager component

Closes #242

Summary by CodeRabbit

  • Bug Fixes

    • Search errors now display as notifications to users
  • Improvements

    • Enhanced package management UI with distinct "Add" and "Add -D" actions
    • Added loading indicators for individual package operations
    • Improved empty state messaging for dependencies section
    • Updated icon-based visual feedback for package management actions

Review Change Stack

@qodo-code-review
Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@github-actions
Copy link
Copy Markdown

👋 Thanks for opening a PR, @vaishnavijha12!

Your PR has entered the 🚦 PR Review Pipeline.

Standard PR detected — your PR will follow the standard review pipeline.


What happens next

Stage Reviewer Checks
Stage 1 — Automated Validation 🤖 Bot DCO · Format · AI/Slop · Duplicate
Stage 2 — Human Review 👥 Maintainer Code + Quality Review
Stage 3 — PA / Maintainer Review 🔑 Project Admin Final Merge Decision

A pipeline status comment will appear below and update automatically as your PR progresses.


While you wait

  • Sign all commits (git commit -s)
  • Link your issue (Closes #123)
  • Use a feature branch (not main)
  • Avoid unrelated changes

This comment is posted only once.

@github-actions github-actions Bot added bug Something isn't working good first issue Good for newcomers labels May 22, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

Walkthrough

The PackageManager component is refactored to add toast-based error reporting for NPM operations, improve type safety for search results and dependencies, and modernize the UI. A typed executeCommand helper now encapsulates install/remove logic with WebContainer validation and exit-code checking. Search and dependency display are re-rendered using Object.entries iteration with per-item loading spinners.

Changes

PackageManager Component Refactoring

Layer / File(s) Summary
Toast import and icon setup
modules/playground/components/package-manager.tsx
Adds toast import from sonner and expands Lucide icon imports to include Trash2, Download, and Loader2 for use in refactored UI components.
State declarations and dependency parsing
modules/playground/components/package-manager.tsx
Introduces explicit state typing for searchResults, dependencies, and devDependencies, and adjusts package.json parsing to extract and set those typed states from templateData.
NPM search and command execution
modules/playground/components/package-manager.tsx
Refactors searchNpm handler to fetch and parse search results with early-return on blank query; extracts executeCommand helper that checks instance readiness, sets loadingPkg, spawns commands, validates exit codes, reports success/failure via toast, and clears loadingPkg in finally block; adjusts dev install argument construction.
Search results and dependencies display UI
modules/playground/components/package-manager.tsx
Refactors search form and results list rendering with icon-based loading spinners and separate Add/Add -D actions; refactors installed dependencies and devDependencies sections to iterate via Object.entries().map(), showing per-package version badges and per-item remove buttons with loading spinners when loadingPkg matches, and updates empty-state messaging.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested Labels

mentor:piyushdotcomm, level:critical

Suggested Reviewers

  • piyushdotcomm

Poem

🐰 A rabbit hops through package trees,
Toast notifs bring the mind some ease,
Spinner wheels spin round and round,
Each dep now loads without a sound,
Types are typed, the UI's bright—
Package management feels just right!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The raw summary shows extensive refactoring of the PackageManager component (187 additions, 85 deletions) beyond just adding a missing import. Clarify whether the extensive component refactoring is intentional or if this PR should focus solely on the missing import fix.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the primary change: adding a missing toast import to fix build errors.
Description check ✅ Passed The description covers the summary and changes made, but omits the checklist items and validation sections from the template.
Linked Issues check ✅ Passed The PR directly addresses issue #242 by importing toast from sonner to resolve the TS2304 build errors.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@modules/playground/components/package-manager.tsx`:
- Around line 181-190: The icon-only submit Button in package-manager.tsx (the
Button rendering Loader2/Search using isSearching) lacks an accessible name; add
an accessible label (e.g., aria-label) to the Button so screen readers can
announce its purpose, and make it dynamic if desired (e.g.,
aria-label={isSearching ? "Searching" : "Search"}) or use a visually hidden text
node tied to the Button to convey the same text.
- Around line 104-113: The code calls fetch against NPM_REGISTRY_SEARCH_URL and
assigns data.objects directly into state via setSearchResults, but fetch doesn't
throw on non-2xx and data.objects may be missing; update the try block around
the request in the package-manager component to first check res.ok and handle
non-2xx by throwing or setting an empty result, then parse JSON and verify that
the parsed payload has a valid objects array (Array.isArray(data.objects))
before calling setSearchResults(searchResults), otherwise setSearchResults([])
or surface an error; reference the existing symbols: NPM_REGISTRY_SEARCH_URL,
searchQuery, res, data, and setSearchResults when implementing the validation
and fallback.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c6340ec1-94a9-44c3-8654-f60cc1d5813b

📥 Commits

Reviewing files that changed from the base of the PR and between 19a3136 and 6b9b7dc.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • modules/playground/components/package-manager.tsx

Comment thread modules/playground/components/package-manager.tsx
Comment thread modules/playground/components/package-manager.tsx
Copy link
Copy Markdown
Owner

@piyushdotcomm piyushdotcomm left a comment

Choose a reason for hiding this comment

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

review the coderabbit suggestion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Missing 'toast' import in package-manager.tsx causing build failure

2 participants