Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(application-system): handle pruned application links #15233

Merged
merged 10 commits into from
Jun 18, 2024

Conversation

jonnigs
Copy link
Member

@jonnigs jonnigs commented Jun 13, 2024

What

If a user has a link to his application, he can enter it and edit even if it's been pruned

Why

An application that has been pruned should not be accessible

Screenshots / Gifs

Screenshot 2024-06-13 at 14 48 41

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Added handling for pruned applications, including new error messages and UI modifications.
  • Bug Fixes

    • Improved error handling logic in application forms.
  • Refactor

    • Refactored ApplicationForm to use a defined Props type for better code clarity.
  • Internationalization

    • Added new error messages for pruned applications in Icelandic.

Copy link
Contributor

coderabbitai bot commented Jun 13, 2024

Walkthrough

The recent update enhances the application's ability to mark certain data as "pruned." Several components now handle this new attribute, including service methods, data transfer objects, and error handling logic. This change aims to clearly delineate and manage pruned data across various application layers, ensuring the system can handle such instances gracefully and consistently.

Changes

File Summary
.../application.response.dto.ts Added pruned property with decorators to BaseApplicationResponseDto class
.../application.model.ts Added pruned property to Application class
.../application.service.ts Updated findOne method to handle pruned attribute by returning modified data
.../messages.ts Added new error messages for pruned applications in Icelandic
.../application.ts Added pruned field to ApplicationFragment GraphQL query
.../ErrorShell.tsx Added new error type pruned to the messageTypes object and updated Props interface
.../ApplicationForm.tsx Refactored component, updated error handling logic to check for pruned flag

Sequence Diagram(s)

sequenceDiagram
    participant UI as User Interface
    participant SVC as ApplicationService
    participant API as Application API

    UI->>SVC: fetchApplication(id, auth, locale)
    SVC->>API: applicationControllerFindOne(id, locale)
    API-->>SVC: applicationData
    alt applicationData.pruned == true
        SVC-->>UI: { data: {...}, answers: {}, attachments: {}, externalData: {} }
        UI->>UI: Display pruned error message
    else
        SVC-->>UI: applicationData
        UI->>UI: Display application data
    end
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jonnigs jonnigs changed the title Feat/handle pruned application links Feat(application-system): handle pruned application links Jun 13, 2024
Copy link

codecov bot commented Jun 13, 2024

Codecov Report

Attention: Patch coverage is 12.50000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 37.10%. Comparing base (a37e90f) to head (cc746c5).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #15233      +/-   ##
==========================================
- Coverage   37.10%   37.10%   -0.01%     
==========================================
  Files        6448     6448              
  Lines      131456   131460       +4     
  Branches    37575    37575              
==========================================
+ Hits        48781    48782       +1     
- Misses      82675    82678       +3     
Flag Coverage Δ
api 3.51% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...odules/application/dto/application.response.dto.ts 97.56% <100.00%> (+0.06%) ⬆️
libs/application/core/src/lib/messages.ts 100.00% <ø> (ø)
...plication/graphql/src/lib/fragments/application.ts 100.00% <ø> (ø)
...application/ui-shell/src/components/ErrorShell.tsx 18.18% <ø> (ø)
...s/application/ui-shell/src/lib/ApplicationForm.tsx 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a37e90f...cc746c5. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Jun 13, 2024

Datadog Report

Branch report: feat/handle-pruned-application-links
Commit report: 214f0f7
Test service: api

✅ 0 Failed, 4 Passed, 0 Skipped, 2.96s Total Time
➡️ Test Sessions change in coverage: 1 no change

@jonnigs jonnigs marked this pull request as ready for review June 13, 2024 15:15
@jonnigs jonnigs requested a review from a team as a code owner June 13, 2024 15:15
Copy link
Contributor

@Halli1414 Halli1414 left a comment

Choose a reason for hiding this comment

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

LGTM

@jonnigs jonnigs changed the title Feat(application-system): handle pruned application links feat(application-system): handle pruned application links Jun 13, 2024
Copy link
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: 2

Outside diff range and nitpick comments (1)
libs/application/ui-shell/src/lib/ApplicationForm.tsx (1)

Line range hint 158-158: Utilize optional chaining for safer property access.

In the populateForm function, when accessing properties of potentially undefined objects, use optional chaining to prevent runtime errors:

- const role = template.mapUserToRole(nationalRegistryId, application)
+ const role = template?.mapUserToRole(nationalRegistryId, application)

This change ensures that the code is more robust and can handle cases where template might be null.

Tools
Biome

[error] 49-49: Unnecessary use of boolean literals in conditional expression. (lint/complexity/noUselessTernary)

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6e86d2a and 40cfc86.

Files selected for processing (7)
  • apps/application-system/api/src/app/modules/application/dto/application.response.dto.ts (1 hunks)
  • libs/api/domains/application/src/lib/application.model.ts (1 hunks)
  • libs/api/domains/application/src/lib/application.service.ts (1 hunks)
  • libs/application/core/src/lib/messages.ts (1 hunks)
  • libs/application/graphql/src/lib/fragments/application.ts (1 hunks)
  • libs/application/ui-shell/src/components/ErrorShell.tsx (2 hunks)
  • libs/application/ui-shell/src/lib/ApplicationForm.tsx (3 hunks)
Additional context used
Path-based instructions (7)
libs/application/graphql/src/lib/fragments/application.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
apps/application-system/api/src/app/modules/application/dto/application.response.dto.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
libs/api/domains/application/src/lib/application.model.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/ui-shell/src/components/ErrorShell.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/ui-shell/src/lib/ApplicationForm.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/api/domains/application/src/lib/application.service.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/core/src/lib/messages.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
Biome
libs/application/ui-shell/src/lib/ApplicationForm.tsx

[error] 49-49: Unnecessary use of boolean literals in conditional expression. (lint/complexity/noUselessTernary)

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with


[error] 158-158: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.

Additional comments not posted (7)
libs/application/graphql/src/lib/fragments/application.ts (1)

39-39: The addition of the pruned field to the GraphQL fragment is appropriate and aligns with the PR objectives.

apps/application-system/api/src/app/modules/application/dto/application.response.dto.ts (1)

182-186: The addition of the pruned field to the BaseApplicationResponseDto class is correctly implemented with appropriate decorators.

libs/api/domains/application/src/lib/application.model.ts (1)

133-134: The addition of the pruned field to the Application class is correctly implemented with appropriate GraphQL decorators, ensuring it's optional.

libs/application/ui-shell/src/components/ErrorShell.tsx (1)

56-60: The addition of the pruned error type in the ErrorShell component is correctly implemented, utilizing existing message constants effectively.

Also applies to: 74-74

libs/application/ui-shell/src/lib/ApplicationForm.tsx (1)

79-81: Handling the pruned state by redirecting to an error page.

This change is consistent with the PR's objective to handle pruned applications by preventing access. The implementation is straightforward and uses existing components effectively.

libs/api/domains/application/src/lib/application.service.ts (1)

51-53: Handle pruned applications by clearing sensitive data.

The implementation effectively clears out the answers, attachments, and externalData fields for pruned applications, ensuring that sensitive data is not exposed. This is a secure and thoughtful way to handle data for pruned applications.

libs/application/core/src/lib/messages.ts (1)

845-862: Add new error messages for pruned applications.

The added messages (prunedTitle, prunedSubTitle, and prunedDescription) are clear and consistent with the rest of the application's error handling. They provide necessary user feedback for pruned applications, aligning with the PR's objectives to handle inaccessible pruned applications appropriately.

libs/application/ui-shell/src/lib/ApplicationForm.tsx Outdated Show resolved Hide resolved
@jonnigs jonnigs added the automerge Merge this PR as soon as all checks pass label Jun 13, 2024
Copy link
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: 2

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 40cfc86 and 07e6ecc.

Files selected for processing (1)
  • libs/application/ui-shell/src/lib/ApplicationForm.tsx (3 hunks)
Additional context used
Path-based instructions (1)
libs/application/ui-shell/src/lib/ApplicationForm.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
Biome
libs/application/ui-shell/src/lib/ApplicationForm.tsx

[error] 48-49: Expected an expression but instead found 'const'. (parse)

Expected an expression here.


[error] 50-50: Expected a statement but instead found ')'. (parse)

Expected a statement here.


[error] 158-158: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 49-49: Shouldn't redeclare 'delegationsChecked'. Consider to delete it or rename it. (lint/suspicious/noRedeclare)

'delegationsChecked' is defined here:


[error] 49-49: Shouldn't redeclare 'setDelegationsChecked'. Consider to delete it or rename it. (lint/suspicious/noRedeclare)

'setDelegationsChecked' is defined here:

Additional comments not posted (2)
libs/application/ui-shell/src/lib/ApplicationForm.tsx (2)

79-81: Handle pruned applications correctly to enhance user experience.

The implementation correctly handles the scenario where an application is pruned by displaying an appropriate error message. This aligns with the PR's objective to prevent access to pruned applications.


195-199: Ensure that ApplicationForm component is properly structured for future scalability.

The restructuring of the ApplicationForm component using destructured props improves readability and maintainability. This is a positive change towards making the codebase more manageable.

@jonnigs jonnigs force-pushed the feat/handle-pruned-application-links branch from 07e6ecc to 4f1bd07 Compare June 14, 2024 11:17
Copy link
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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 07e6ecc and 4f1bd07.

Files selected for processing (7)
  • apps/application-system/api/src/app/modules/application/dto/application.response.dto.ts (1 hunks)
  • libs/api/domains/application/src/lib/application.model.ts (1 hunks)
  • libs/api/domains/application/src/lib/application.service.ts (1 hunks)
  • libs/application/core/src/lib/messages.ts (1 hunks)
  • libs/application/graphql/src/lib/fragments/application.ts (1 hunks)
  • libs/application/ui-shell/src/components/ErrorShell.tsx (2 hunks)
  • libs/application/ui-shell/src/lib/ApplicationForm.tsx (3 hunks)
Files skipped from review due to trivial changes (2)
  • libs/application/graphql/src/lib/fragments/application.ts
  • libs/application/ui-shell/src/components/ErrorShell.tsx
Additional context used
Path-based instructions (5)
apps/application-system/api/src/app/modules/application/dto/application.response.dto.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
libs/api/domains/application/src/lib/application.model.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/ui-shell/src/lib/ApplicationForm.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/api/domains/application/src/lib/application.service.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/core/src/lib/messages.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
Biome
libs/application/ui-shell/src/lib/ApplicationForm.tsx

[error] 48-49: Expected an expression but instead found 'const'. (parse)

Expected an expression here.


[error] 50-50: Expected a statement but instead found ')'. (parse)

Expected a statement here.


[error] 158-158: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 49-49: Shouldn't redeclare 'delegationsChecked'. Consider to delete it or rename it. (lint/suspicious/noRedeclare)

'delegationsChecked' is defined here:


[error] 49-49: Shouldn't redeclare 'setDelegationsChecked'. Consider to delete it or rename it. (lint/suspicious/noRedeclare)

'setDelegationsChecked' is defined here:

Additional comments not posted (4)
apps/application-system/api/src/app/modules/application/dto/application.response.dto.ts (1)

182-186: LGTM! The pruned property is correctly added with appropriate decorators for API exposure and validation.

libs/api/domains/application/src/lib/application.model.ts (1)

133-134: LGTM! The pruned field is correctly added as an optional, nullable GraphQL field, aligning with the model's requirements.

libs/application/ui-shell/src/lib/ApplicationForm.tsx (1)

79-81: The handling of pruned applications using an early return pattern is appropriate and cleanly implemented.

libs/api/domains/application/src/lib/application.service.ts (1)

51-53: The logic to handle pruned applications by clearing sensitive data is secure and well-implemented.

libs/application/core/src/lib/messages.ts Show resolved Hide resolved
@jonnigs jonnigs force-pushed the feat/handle-pruned-application-links branch from 4f1bd07 to 637d715 Compare June 18, 2024 09:26
Copy link
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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4f1bd07 and 637d715.

Files selected for processing (7)
  • apps/application-system/api/src/app/modules/application/dto/application.response.dto.ts (1 hunks)
  • libs/api/domains/application/src/lib/application.model.ts (1 hunks)
  • libs/api/domains/application/src/lib/application.service.ts (1 hunks)
  • libs/application/core/src/lib/messages.ts (1 hunks)
  • libs/application/graphql/src/lib/fragments/application.ts (1 hunks)
  • libs/application/ui-shell/src/components/ErrorShell.tsx (2 hunks)
  • libs/application/ui-shell/src/lib/ApplicationForm.tsx (3 hunks)
Files skipped from review as they are similar to previous changes (6)
  • apps/application-system/api/src/app/modules/application/dto/application.response.dto.ts
  • libs/api/domains/application/src/lib/application.model.ts
  • libs/api/domains/application/src/lib/application.service.ts
  • libs/application/core/src/lib/messages.ts
  • libs/application/graphql/src/lib/fragments/application.ts
  • libs/application/ui-shell/src/components/ErrorShell.tsx
Additional context used
Path-based instructions (1)
libs/application/ui-shell/src/lib/ApplicationForm.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
Biome
libs/application/ui-shell/src/lib/ApplicationForm.tsx

[error] 48-49: Expected an expression but instead found 'const'. (parse)

Expected an expression here.


[error] 50-50: Expected a statement but instead found ')'. (parse)

Expected a statement here.


[error] 158-158: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 49-49: Shouldn't redeclare 'delegationsChecked'. Consider to delete it or rename it. (lint/suspicious/noRedeclare)

'delegationsChecked' is defined here:


[error] 49-49: Shouldn't redeclare 'setDelegationsChecked'. Consider to delete it or rename it. (lint/suspicious/noRedeclare)

'setDelegationsChecked' is defined here:

Additional comments not posted (3)
libs/application/ui-shell/src/lib/ApplicationForm.tsx (3)

36-40: Refine TypeScript Props definition for enhanced type safety.


79-81: Proper implementation of the pruned application handling logic.


195-199: The structure of ApplicationForm export is correctly maintained.

libs/application/ui-shell/src/lib/ApplicationForm.tsx Outdated Show resolved Hide resolved
Copy link
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: 0

Outside diff range and nitpick comments (1)
libs/application/ui-shell/src/lib/ApplicationForm.tsx (1)

Line range hint 156-156: Consider using optional chaining to ensure safety when accessing nested properties.

- const currentRole = stateInformation.roles.find((r) => r.id === role)
+ const currentRole = stateInformation?.roles?.find((r) => r.id === role)
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 637d715 and e5fcb1b.

Files selected for processing (1)
  • libs/application/ui-shell/src/lib/ApplicationForm.tsx (3 hunks)
Additional context used
Path-based instructions (1)
libs/application/ui-shell/src/lib/ApplicationForm.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
Biome
libs/application/ui-shell/src/lib/ApplicationForm.tsx

[error] 156-156: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.

Additional comments not posted (4)
libs/application/ui-shell/src/lib/ApplicationForm.tsx (4)

36-40: Refine TypeScript Props definition for enhanced type safety.


48-48: Ensure the negation logic for delegationsChecked is clear and intentional.


77-79: Correct implementation to handle pruned applications by showing an error shell.


193-197: Ensure the ApplicationForm component correctly passes all required props to ApplicationLoader.

@jonnigs jonnigs force-pushed the feat/handle-pruned-application-links branch from e5fcb1b to 966c6e1 Compare June 18, 2024 10:45
Copy link
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: 0

Outside diff range and nitpick comments (1)
libs/application/ui-shell/src/lib/ApplicationForm.tsx (1)

Line range hint 156-156: Consider using optional chaining for better safety and readability.

- const currentRole = stateInformation.roles.find((r) => r.id === role)
+ const currentRole = stateInformation?.roles?.find((r) => r.id === role)

Using optional chaining here prevents potential runtime errors if stateInformation or roles is undefined.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e5fcb1b and 966c6e1.

Files selected for processing (7)
  • apps/application-system/api/src/app/modules/application/dto/application.response.dto.ts (1 hunks)
  • libs/api/domains/application/src/lib/application.model.ts (1 hunks)
  • libs/api/domains/application/src/lib/application.service.ts (1 hunks)
  • libs/application/core/src/lib/messages.ts (1 hunks)
  • libs/application/graphql/src/lib/fragments/application.ts (1 hunks)
  • libs/application/ui-shell/src/components/ErrorShell.tsx (2 hunks)
  • libs/application/ui-shell/src/lib/ApplicationForm.tsx (3 hunks)
Files skipped from review as they are similar to previous changes (6)
  • apps/application-system/api/src/app/modules/application/dto/application.response.dto.ts
  • libs/api/domains/application/src/lib/application.model.ts
  • libs/api/domains/application/src/lib/application.service.ts
  • libs/application/core/src/lib/messages.ts
  • libs/application/graphql/src/lib/fragments/application.ts
  • libs/application/ui-shell/src/components/ErrorShell.tsx
Additional context used
Path-based instructions (1)
libs/application/ui-shell/src/lib/ApplicationForm.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
Biome
libs/application/ui-shell/src/lib/ApplicationForm.tsx

[error] 156-156: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.

Additional comments not posted (3)
libs/application/ui-shell/src/lib/ApplicationForm.tsx (3)

36-40: Refine TypeScript Props definition for enhanced type safety.


48-48: Simplify the conditional expression for better readability.


77-79: Handle pruned applications by displaying an appropriate error shell.

This change correctly implements the handling for pruned applications, making them inaccessible as intended by the PR objectives.

@kodiakhq kodiakhq bot merged commit 579ee9f into main Jun 18, 2024
35 checks passed
@kodiakhq kodiakhq bot deleted the feat/handle-pruned-application-links branch June 18, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants