mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-05 06:03:51 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The Plugins page lets users connect third-party apps directly or through aggregators like Composio and Arcade. > - When an app offers multiple aggregators, clicking Connect opens AggregatorConnectDialog so the user can choose a provider. > - Selecting Composio with no saved Composio gateway, or clicking Connect new account, called onNavigate and then immediately called onClose. > - In Browse, closeAggregatorSetup checked window.location.search for source=composio, matched the URL that onNavigate had just pushed, and replaced the route with /apps. > - This pull request stops in-app dialog navigation from calling onClose, clears dialog state in Browse's navigation handler, and reads React Router's location.search instead of window.location.search. > - The benefit is that choosing Composio or adding a new Composio account from the connect modal navigates cleanly to /apps/connect while dismissing the modal still strips ?source=composio. ## Linked Issues or Issue Description No public GitHub issue exists for this report (searched open and closed issues and PRs for duplicates). **What happened?** When going to Plugins -> Slack -> Connect and clicking Composio without a saved Composio gateway, the connect modal closed and redirected back to /apps instead of opening /apps/connect?source=composio&targetToolkit=slack. The same redirect happened when opening the modal via /apps?source=composio&targetToolkit=slack and clicking Connect new account. **Expected behavior** Clicking Composio with no saved Composio gateway navigates to /apps/connect?source=composio&targetToolkit=slack. Clicking Connect new account navigates to /apps/connect?source=composio&targetToolkit=slack&new=1. Dismissing the modal without navigating still closes it and strips ?source=composio back to /apps. **Steps to reproduce** 1. Open Plugins on a Cloud instance where Slack yields to aggregators and no Composio gateway is saved. 2. Open Slack and click Connect. 3. Click Composio in the Connect Slack dialog. 4. Observe that the dialog closes and the page stays on /apps instead of navigating to /apps/connect?source=composio&targetToolkit=slack. **Access context** Board (human operator) ## What Changed - Updated `ui/src/pages/apps/AggregatorConnectDialog.tsx` so in-app navigation handlers (`choose`, `onConnectNew`, and the non-Composio "Connect a new account" button) call only `onNavigate` without also invoking `onClose`. - Updated `ui/src/pages/apps/Browse.tsx` to pass `navigateFromAggregatorSetup` as `AggregatorConnectDialog`'s `onNavigate` prop so navigation clears dialog state without triggering `closeAggregatorSetup`'s `?source=composio` redirect cleanup. - Switched `Browse.tsx` from `window.location.search` to React Router's `useLocation().search` for the `?source=...` effect and dismissal cleanup. - Added `ui/src/pages/apps/Browse.aggregatorConnect.test.tsx` with real `BrowserRouter` regression tests covering Plugins -> Slack -> Connect -> Composio, new-account navigation from `?source=composio`, dismissal cleanup, and staying on the plugin page when cancelling. ## Verification - Verified TDD red-before / green-after on `ui/src/pages/apps/Browse.aggregatorConnect.test.tsx`: before the fix, both Composio navigation tests failed with `Received: "/PAP/apps"` instead of `/PAP/apps/connect?source=composio&targetToolkit=slack` and `...&new=1`. - Ran `pnpm vitest run ui/src/pages/apps/Browse.aggregatorConnect.test.tsx ui/src/pages/apps/Browse.pluginTileState.test.ts ui/src/pages/apps/AppsConnect.test.tsx ui/src/lib/analytics/replay-masking.test.tsx` on rebased HEAD `c605d6358c`: 4 test files, 243 tests passed. - Ran `pnpm --filter @paperclipai/ui typecheck`: passed with 0 errors. - CI covers repo-wide typecheck, build, and test suites on the pushed PR revision. ## Risks - Low risk. Changes are scoped to `AggregatorConnectDialog` and `Browse`'s aggregator connect dialog wiring. Dismissal actions (Cancel, Escape, dialog close, completion, and external management links) still invoke `closeAggregatorSetup` to invalidate aggregator queries and strip `?source=composio`. ## Model Used - Google Gemini 4 (Antigravity agent with extended reasoning and local tool/test execution). ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [ ] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge Co-authored-by: Paperclip <noreply@paperclip.ing>