Mariano/fixes - #161
Mariano/fixes#161
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
WalkthroughThis update refactors various components and pages to dynamically construct URL paths using the organization identifier. Static paths have been replaced with dynamic ones by extracting the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Component
participant Router
User->>Component: Clicks on a dynamically generated link
Note right of Component: Extracts orgId via useParams/session
Component->>Router: Constructs URL using `/[orgId]/...` and navigates
Router->>User: Renders the organization-specific page
Possibly related PRs
Poem
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (15)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/components/FrameworkProgress.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/components/RequirementStatusChart.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/overview/frameworks/[frameworkId]/components/table/FrameworkControlsTableColumns.tsx(3 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/comments/page.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/layout.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/page.tsx(2 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/tasks/[taskId]/page.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/(overview)/page.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/[testId]/actions/createTestComment.ts(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/page.tsx(1 hunks)apps/app/src/components/tables/risk-register/columns.tsx(1 hunks)apps/app/src/components/tables/risk-tasks/columns.tsx(1 hunks)apps/app/src/components/tables/risk-tasks/empty-states.tsx(1 hunks)apps/app/src/components/tables/tests/empty-states.tsx(3 hunks)apps/app/src/jobs/tasks/notifications/risk-task-notification.ts(1 hunks)
🧰 Additional context used
🧬 Code Definitions (4)
apps/app/src/components/tables/risk-tasks/columns.tsx (1)
apps/app/src/components/tables/risk-register/columns.tsx (1) (1)
columns(25-111)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/components/RequirementStatusChart.tsx (1)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/overview/frameworks/[frameworkId]/components/table/FrameworkControlsTableColumns.tsx (1) (1)
OrganizationControlType(21-37)
apps/app/src/components/tables/risk-register/columns.tsx (2)
apps/app/src/components/tables/risk-tasks/columns.tsx (1) (1)
columns(25-103)apps/app/src/components/tables/policies/columns.tsx (1) (1)
columns(23-76)
apps/app/src/components/tables/risk-tasks/empty-states.tsx (1)
apps/app/src/components/tables/tests/empty-states.tsx (1) (1)
NoResults(13-44)
🔇 Additional comments (29)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/layout.tsx (1)
26-26: LGTM! Dynamic path correctly implementedThe redirect path now correctly includes the organization ID with a proper leading slash, ensuring users are redirected to their organization-specific risk page.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/[testId]/actions/createTestComment.ts (1)
34-34: LGTM! Path revalidation correctly updatedThe revalidation path now correctly includes the organization ID, ensuring that the proper context-specific path is revalidated after a comment is created.
apps/app/src/jobs/tasks/notifications/risk-task-notification.ts (1)
52-52: Improved recordId by incorporating organization contextThe update to include
owner.organizationIdin the recordId path ensures proper organization-specific context in notifications. This change is consistent with the app-wide effort to dynamically construct URL paths using organization identifiers.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/comments/page.tsx (1)
11-86: Code formatting improvementsThe indentation has been standardized throughout the file using tabs instead of a mix of spaces and tabs. This improves readability and consistency with the codebase style. No functional changes were made.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/page.tsx (1)
11-74: Code formatting and dynamic URL improvementsThe indentation has been standardized throughout the file using tabs. Additionally, the redirect URL now correctly includes the organization context (
/${session.user.organizationId}/risk/register), consistent with the app-wide effort to use dynamic organization-specific URLs.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/page.tsx (1)
9-250: Code formatting and indentation improvementsThe file has been reformatted with consistent tab indentation throughout, improving readability while maintaining the same functionality. The redirect on line 71 now properly includes the organization context (
/${session.user.organizationId}/risk), aligning with the app-wide effort to use dynamic organization-specific URLs.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/overview/frameworks/[frameworkId]/components/table/FrameworkControlsTableColumns.tsx (3)
20-20: Good addition of the useParams hook import.This import allows the component to access the route parameters dynamically, which is essential for the URL structure changes.
65-65: Well implemented parameter extraction.Correctly extracting the organization ID from route parameters and using TypeScript's generic type to ensure proper typing.
76-76: Appropriately updated link with dynamic orgId.The href has been properly updated to use the dynamic organization ID from the route parameters, making the routing more consistent with the application's overall structure.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/(overview)/page.tsx (4)
11-46: Clean formatting improvements to the TestsOverview component.The indentation changes improve readability without changing the component's functionality.
28-28: Good update to include dynamic orgId in redirect path.The redirect path now correctly incorporates the user's organization ID, maintaining consistency with the application's dynamic routing approach.
48-107: Well-formatted database transaction code.The indentation and structure changes make the complex Promise.all database queries more readable while maintaining functionality.
109-121: Consistently formatted metadata function.The formatting changes in the generateMetadata function follow the same pattern as the rest of the file, maintaining consistency.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/tasks/[taskId]/page.tsx (4)
13-13: Improved type for params property.The formatting change to the params property type maintains consistency with other similar interfaces in the codebase.
17-42: Well-formatted component logic.The indentation changes improve readability of the component's session validation and task retrieval logic without changing functionality.
31-31: Good update to include dynamic orgId in redirect path.The redirect path now correctly uses the user's organization ID when a task is not found, maintaining consistency with the application's routing approach.
45-62: Consistently formatted data fetching functions.The indentation changes to the getTask and getUsers functions improve readability while maintaining the same functionality.
Also applies to: 64-87
apps/app/src/components/tables/risk-tasks/columns.tsx (5)
10-10: Good addition of the useParams hook import.This import allows the component to access the route parameters dynamically, consistent with the changes in other files.
12-23: Well-formatted RiskTaskType interface.The indentation changes to the RiskTaskType interface improve readability without changing the type structure.
25-27: Correctly implemented parameter extraction.The useParams hook is used properly to extract the organization ID, following the same pattern as in other files.
39-39: Appropriate update to include dynamic orgId in link path.The link path now correctly incorporates the organization ID from the route parameters, maintaining consistency with the application's dynamic routing approach.
29-102: Well-formatted column definitions.The indentation changes to the column definitions improve readability while maintaining the same functionality across all columns.
apps/app/src/components/tables/risk-register/columns.tsx (3)
11-11: Good addition of useParams hookAdding the
useParamshook fromnext/navigationis a necessary step for the refactoring of URL paths to include organization context.
27-27: Well implemented parameter extractionExtracting the
orgIdfrom URL parameters with proper type definition ensures type safety in your routing.
40-40: Good implementation of dynamic URL constructionThe refactoring to include the organization ID in the URL structure is a good practice for maintaining organization-specific context in navigation.
apps/app/src/components/tables/risk-tasks/empty-states.tsx (2)
19-19: Correctly updated parameter extractionThe expanded parameter extraction now includes both
orgIdandriskId, which properly supports the dynamic URL construction pattern being implemented across the application.
39-39: Properly updated navigation pathThe Button's onClick handler now correctly redirects to a path that includes the organization context, maintaining consistency with the overall architecture changes.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/components/RequirementStatusChart.tsx (2)
11-11: Good addition of useParams hookAdding the
useParamshook is necessary for accessing the organization ID from the URL parameters.
64-64: Well implemented parameter extractionExtracting the
orgIdwith proper type safety ensures the correct usage in URL construction.
| <Button | ||
| variant="outline" | ||
| onClick={() => router.push(`${orgId}/tests`)} | ||
| > |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Add leading slash to prevent incorrect navigation
The path construction is missing a leading slash, which could lead to incorrect navigation. The correct format should be /${orgId}/tests for absolute paths.
- onClick={() => router.push(`${orgId}/tests`)}
+ onClick={() => router.push(`/${orgId}/tests`)}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <Button | |
| variant="outline" | |
| onClick={() => router.push(`${orgId}/tests`)} | |
| > | |
| <Button | |
| variant="outline" | |
| onClick={() => router.push(`/${orgId}/tests`)} | |
| > |
| </p> | ||
| <Button asChild className="mt-4"> | ||
| <Link href="/overview/frameworks"> | ||
| <Link href={`${orgId}/overview/frameworks`}> |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Add leading slash to prevent incorrect navigation
The href attribute is missing a leading slash, which could lead to incorrect navigation. This is inconsistent with other links in the same file (lines 156, 166, 176) that correctly use a leading slash.
- <Link href={`${orgId}/overview/frameworks`}>
+ <Link href={`/${orgId}/overview/frameworks`}>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <Link href={`${orgId}/overview/frameworks`}> | |
| <Link href={`/${orgId}/overview/frameworks`}> |
|
|
||
| return ( | ||
| <Link | ||
| href={`${orgId}/overview/frameworks/${framework.framework.id}`} |
There was a problem hiding this comment.
Missing leading slash in URL path
The URL construction appears to be missing a leading slash before the orgId variable. Unlike other implementations (e.g., /${orgId}/risk/...), this could potentially result in a relative URL rather than an absolute path from the root.
Apply this change:
-href={`${orgId}/overview/frameworks/${framework.framework.id}`}
+href={`/${orgId}/overview/frameworks/${framework.framework.id}`}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| href={`${orgId}/overview/frameworks/${framework.framework.id}`} | |
| href={`/${orgId}/overview/frameworks/${framework.framework.id}`} |
Summary by CodeRabbit