fix(web): remove orphaned hasPermission inline body in roles-manager#1433
Conversation
PR MODSetter#1428 (issue MODSetter#1366) extracted the inline `hasPermission` callback into a shared `canPerform` helper but left the original arrow-function body, its dependency array, and trailing `)` behind after the new `useCallback` block. The result was a syntactically invalid statement that broke `pnpm build` on the `dev` branch and is now blocking every E2E job in the PR queue. Delete the orphaned lines so the file parses again. No behavior change — the working `useCallback(canPerform(access, permission))` already supplies the same predicate the duplicated body did.
|
@suryo12 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Refactors roles permission checking in the settings UI to reuse a shared canPerform helper instead of inlining permission logic.
Changes:
- Reordered imports to include
canPerformalongsidemyAccessAtom. - Removed the inline permission-checking implementation and delegated checks to the shared
canPerform(access, permission)helper.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| (permission: string) => canPerform(access, permission), | ||
| [access] | ||
| ); |
There was a problem hiding this comment.
The local callback here is hasPermission, not canPerform, so there's no shadow — canPerform resolves to the imported helper on line 29. The sister file team-content.tsx (touched in the same originating PR #1428) ships the identical pattern, so this patch only restores parity. No rename needed.
Removes orphaned arrow-function code left behind in
roles-manager.tsxafter PR #1428 (for issue #1366) extractedhasPermissioninto the sharedcanPerformhelper. The leftover lines produce a parse error that breakspnpm buildand currently fails the E2E job on every PR targetingdev.Description
components/settings/roles-manager.tsxends up with two function bodies stacked on top of each other after the merge — the newuseCallback(canPerform(...))block closes correctly, then a second arrow function, its dependency array, and a trailing)follow with no enclosing call. This patch deletes those orphan lines.Before:
After:
The remaining
useCallbackalready supplies the same predicate the duplicated body computed (canPerformwas extracted from that exact body in #1428), so behavior is unchanged.Motivation and Context
Currently any PR opened against
devfails theJourneyE2E job because Playwright'swebServerrunspnpm build && pnpm startin CI — andpnpm buildexits 1 withExpression expectedonroles-manager.tsx:269. Confirmed locally on a cleandevcheckout. After this patchpnpm buildcompletes successfully.Sister file
app/dashboard/[search_space_id]/team/team-content.tsx(the other file #1428 touched) was migrated cleanly and is not affected.Screenshots
N/A — bug fix, no UI change.
API Changes
Change Type
Testing Performed
Reproduced the failure on a clean
devcheckout:pnpm buildexits 1 withExpression expectedatroles-manager.tsx:269.After the patch:
pnpm buildcompletes successfully,pnpm exec biome check ./components/settings/roles-manager.tsxpasses.No behavior to QA — the deleted lines were never reachable code.
Tested locally
Manual/QA verification
Checklist
High-level PR Summary
This PR fixes a build-breaking syntax error in
roles-manager.tsxby removing orphaned code leftover from a previous refactoring. After PR #1428 extracted thehasPermissionlogic into a sharedcanPerformhelper, duplicate function body lines were inadvertently left behind, causing parse errors that brokepnpm buildand failed E2E tests. The fix also reorders the import statement for consistency.⏱️ Estimated Review Time: 5-15 minutes
💡 Review Order Suggestion
surfsense_web/components/settings/roles-manager.tsx