Skip to content

[Fix] Fix Various bugs on the Explore Apps Page#1142

Merged
nams1570 merged 6 commits into
devfrom
explore-apps-bugs
Feb 3, 2026
Merged

[Fix] Fix Various bugs on the Explore Apps Page#1142
nams1570 merged 6 commits into
devfrom
explore-apps-bugs

Conversation

@nams1570
Copy link
Copy Markdown
Collaborator

@nams1570 nams1570 commented Jan 29, 2026

Context

There are a smattering of bugs on the explore apps page. Clicking "Enable App" may enable the app, but the button still shows, plus it causes unnecessary redirects while the modal is still up. This behavior can be seen in the linked clip

Explore.Apps.before.mov

Summary of Changes

We dynamically handle the modal open state, and track the path updates. This lets us deal with the bugs above while avoiding unnecessary renders, allowing reopening of previously opened modals, and preventing unnecessary redirects.
Dealing with the enable apps button issues also now allows users to navigate to the app page from the explore apps modal.

We also add a disable button to the modal. Previously, users had to check the options for each app in order to disable it. Now they can do it on the modal itself, which is in line with how the "Enable App" functionality works.

UI Demo

Explore.Apps.After.with.disable.mov

Summary by CodeRabbit

  • New Features

    • Apps now show live enabled/disabled status and provide a route-aware modal for opening and managing an app.
  • Bug Fixes / Improvements

    • Modal navigation improved: avoids duplicate navigation, respects direct modal routes, and reliably returns to the apps list when closed.
  • Style

    • Disable action updated to a larger, ghost-styled control with clearer red emphasis.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
stack-backend Ready Ready Preview, Comment Feb 3, 2026 1:05am
stack-dashboard Ready Ready Preview, Comment Feb 3, 2026 1:05am
stack-demo Ready Ready Preview, Comment Feb 3, 2026 1:05am
stack-docs Ready Ready Preview, Comment Feb 3, 2026 1:05am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

Client modal open state is derived from the pathname; per-project app enabled state is read from config; handlers added for open, open-change, and disable that navigate with router.replace; isEnabled, onOpen, and onDisable are passed into AppStoreEntry.

Changes

Cohort / File(s) Summary
Modal route & navigation
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/@modal/(.)apps/[appId]/page-client.tsx
Replaces always-open Dialog with pathname-driven isOpen; adds isEnabled from project config, handleOpen, handleOpenChange, and handleDisable; uses router.replace for navigation and guards duplicate redirects; passes isEnabled, onOpen, onDisable to AppStoreEntry.
AppStoreEntry UI tweak
apps/dashboard/src/components/app-store-entry.tsx
Adjusts Disable button props/classes when onDisable is present (variant → ghost, size → lg, adds red text styling). No public API signature changes.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Router
  participant Modal
  participant Config
  participant AppEntry

  User->>Router: navigate to modal route (/projects/:id/@modal/apps/:appId)
  Router->>Modal: render modal (isOpen derived from pathname)
  Modal->>Config: read project apps config (apps.installed[appId].enabled)
  Config-->>Modal: return isEnabled
  Modal->>AppEntry: render with isEnabled, onOpen, onDisable
  User->>AppEntry: click "Open"
  AppEntry->>Modal: call onOpen()
  Modal->>Router: router.replace to app frontend path (guarded)
  User->>Modal: close modal
  Modal->>Router: router.replace back to apps list
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 I hopped along the pathname way,
Modal opened where routes now say.
I checked the config, flipped a switch,
Replaced the route without a glitch.
Nibbles of code and carrot play. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
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 (2 passed)
Check name Status Explanation
Title check ✅ Passed The title '[Fix] Fix Various bugs on the Explore Apps Page' clearly and specifically describes the main purpose of the PR—fixing multiple bugs on the Explore Apps page.
Description check ✅ Passed The PR description provides detailed context, explains the specific bugs fixed, summarizes changes with clear rationale, and includes demo videos showing the improvements.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch explore-apps-bugs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@nams1570 nams1570 marked this pull request as ready for review January 29, 2026 19:23
Copilot AI review requested due to automatic review settings January 29, 2026 19:23
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jan 29, 2026

Greptile Overview

Greptile Summary

This PR fixes modal state management issues on the explore apps page. The main changes separate navigation from the enable action, dynamically track modal state, and coordinate pathname changes with navigation intent.

Key improvements:

  • Removed artificial wait(1000) delay from enable handler
  • Separated enabling an app from navigating to it (new handleOpen function)
  • Added state management (isOpen, navigateTo, hasNavigatedRef) to prevent premature redirects while modal is open
  • Modal now reopens correctly when navigating back to modal routes
  • Users can now navigate to app page from modal after enabling

The implementation uses two useEffect hooks: one watches pathname changes to reset modal state, another handles navigation after modal closes.

Confidence Score: 4/5

  • Safe to merge after wrapping async handler with error handling utility
  • The changes improve UX by fixing legitimate modal state bugs. Logic is sound with proper state coordination between pathname changes and navigation. Only issue is missing runAsynchronouslyWithAlert wrapper per codebase convention for async button handlers.
  • No files require special attention

Important Files Changed

Filename Overview
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/@modal/(.)apps/[appId]/page-client.tsx improved modal state management and navigation handling, missing error handling wrapper for async button handler

Sequence Diagram

sequenceDiagram
    participant User
    participant Modal as AppDetailsModal
    participant Router
    participant Config as ConfigUpdate
    participant AppStore as AppStoreEntry

    User->>Modal: Opens app details modal
    Modal->>Modal: setIsOpen(true)
    Modal->>Modal: pathname effect triggers
    Modal->>AppStore: Renders with isEnabled status
    
    alt App Not Enabled
        User->>AppStore: Clicks Enable App
        AppStore->>Modal: handleEnable()
        Modal->>Config: updateConfig()
        Config-->>Modal: Success
        Note over Modal: isEnabled updates via config hook
        AppStore->>AppStore: Re-renders showing Open App button
    end
    
    alt App Enabled
        User->>AppStore: Clicks Open App
        AppStore->>Modal: handleOpen()
        Modal->>Modal: hasNavigatedRef = false
        Modal->>Modal: setNavigateTo(path)
        Modal->>Modal: setIsOpen(false)
        Modal->>Modal: Navigation effect triggers
        Modal->>Router: router.replace(navigateTo)
    end
    
    alt User Closes Modal
        User->>Modal: Closes modal
        Modal->>Modal: handleOpenChange(false)
        Modal->>Modal: setIsOpen(false)
        alt No pending navigation
            Modal->>Router: router.replace to apps list
        end
    end
Loading

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Copy link
Copy Markdown
Contributor

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

This PR fixes multiple bugs on the explore apps page, specifically addressing issues where clicking "Enable App" would show the button even after the app was enabled, and preventing unnecessary redirects while the modal is still open.

Changes:

  • Implemented dynamic modal state management using isOpen, navigateTo, and hasNavigatedRef to control modal visibility and navigation timing
  • Added pathname tracking to properly handle modal route transitions and prevent stale navigation attempts
  • Removed the artificial 1-second delay (wait(1000)) from the enable app flow and improved the navigation logic to allow users to open the app page directly from the modal after enabling

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

@nams1570 nams1570 requested a review from N2D4 January 29, 2026 20:30
Copy link
Copy Markdown
Contributor

@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: 1

🤖 Fix all issues with AI agents
In
`@apps/dashboard/src/app/`(main)/(protected)/projects/[projectId]/@modal/(.)apps/[appId]/page-client.tsx:
- Around line 62-76: The modal is being closed immediately before navigation can
be confirmed, which can leave the UI on the modal route with the modal hidden;
update handleOpen and handleOpenChange to start navigation but not call
setIsOpen(false) until the pathname actually changes: remove the immediate
setIsOpen(false) in handleOpen, and in handleOpenChange when open becomes false
do router.replace(`/projects/${project.id}/apps`) (or setNavigateTo) without
closing the modal; rely on the existing pathname effect (which should compare
the current pathname to the modal route and use hasNavigatedRef) to
setIsOpen(false) only after the router pathname successfully changes, and ensure
hasNavigatedRef.current is reset appropriately so retries are possible if
navigation is vetoed.
🧹 Nitpick comments (1)
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/@modal/(.)apps/[appId]/page-client.tsx (1)

74-75: Use encodeURIComponent (or urlString) for the base apps path.
The project id is interpolated directly into a URL string; please encode it for consistency and safety.

🔧 Proposed tweak
-        router.replace(`/projects/${project.id}/apps`);
+        router.replace(`/projects/${encodeURIComponent(project.id)}/apps`);

As per coding guidelines: Use urlString template literals or encodeURIComponent() instead of normal string interpolation for URLs, for consistency.

Before, an app on explore app would
 show enable app even when
  enabled.
Also, the open page button behavior was buggy.
We now prevent random redirects behind the modal.
isOpen was sued to render modal.
It was never reset to true.
However, pathname still updated
 on clicking the appentry.
So we use a change in pathname to update isOpen.
We check to make sure that pathname change is to an app entry,
 else modal would reopen randomly on going to the base exporeapps page too.
This deals with issues in our old approach.
If a confirmation dialog pops up, and the user declines to navigate,
the modal will not be closed.
@nams1570 nams1570 merged commit 9002b63 into dev Feb 3, 2026
27 checks passed
@nams1570 nams1570 deleted the explore-apps-bugs branch February 3, 2026 01:36
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