-
Notifications
You must be signed in to change notification settings - Fork 61
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(ojoi): Repost failed applications #17411
Conversation
…ted a previous advert the inputs fields were not updating. Switched out controller components since we have our own.
…er selected a previous advert the inputs fields were not updating. Switched out controller components since we have our own." This reverts commit 081223e.
WalkthroughThis pull request introduces a new functionality for posting applications in the Official Journal of Iceland application system. The changes span multiple files across the application, adding a new mutation method in the resolver, updating the frontend hooks and components, and introducing new GraphQL mutations and error messages. The implementation enables users to submit applications with improved error handling and user experience. Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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? 🪧 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
Documentation and Community
|
There was a problem hiding this 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
🧹 Nitpick comments (4)
libs/application/templates/official-journal-of-iceland/src/hooks/useUpdateApplication.ts (2)
50-57
: Use consistent naming and grouping for newly added hook results.These lines define the new mutation array destructuring. Ensure the naming conventions match your codebase’s established patterns (e.g.,
mutationResult
,data
,error
).
107-121
: Consider optional chaining for improved readability.On line 118, you can use optional chaining to avoid explicitly checking if
onComplete
exists:- onComplete && onComplete() + onComplete?.()🧰 Tools
🪛 Biome (1.9.4)
[error] 118-118: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
libs/application/templates/official-journal-of-iceland/src/fields/Submitted.tsx (1)
139-152
: Reload logic in callback could restart the submission state.The callback to
window.location.reload()
once the posting completes or fails is acceptable but might be disruptive to the user. Consider a more user-friendly approach, such as refetching data or updating state without a full page reload.libs/application/templates/official-journal-of-iceland/src/graphql/queries.ts (1)
360-364
: Consider returning a status or data field to confirm mutation success.The current mutation does not return any data—only the field call to
OJOIAPostApplication(input: $input)
. For improved resilience, client-side error handling, and clarity, returning an explicitsuccess
field or other relevant data would let the UI confirm that the server successfully processed the request.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
libs/api/domains/official-journal-of-iceland-application/src/lib/ojoiApplication.resolver.ts
(1 hunks)libs/application/templates/official-journal-of-iceland/src/fields/Submitted.tsx
(3 hunks)libs/application/templates/official-journal-of-iceland/src/graphql/queries.ts
(1 hunks)libs/application/templates/official-journal-of-iceland/src/hooks/useUpdateApplication.ts
(4 hunks)libs/application/templates/official-journal-of-iceland/src/lib/messages/submitted.tsx
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
libs/application/templates/official-journal-of-iceland/src/graphql/queries.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/templates/official-journal-of-iceland/src/lib/messages/submitted.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/official-journal-of-iceland-application/src/lib/ojoiApplication.resolver.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/templates/official-journal-of-iceland/src/fields/Submitted.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/templates/official-journal-of-iceland/src/hooks/useUpdateApplication.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 (1.9.4)
libs/application/templates/official-journal-of-iceland/src/hooks/useUpdateApplication.ts
[error] 118-118: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: prepare
🔇 Additional comments (6)
libs/application/templates/official-journal-of-iceland/src/lib/messages/submitted.tsx (1)
45-55
: Messages look great!Both the title and message are aligned with existing message definitions. No issues noted.
libs/application/templates/official-journal-of-iceland/src/hooks/useUpdateApplication.ts (2)
15-15
: Explicit import ofPOST_APPLICATION_MUTATION
is fine.This import cleanly indicates where the mutation originates. Looks good.
147-150
: Exported mutation references are clearly defined.The destructured
postApplication
,postApplicationData
,postApplicationError
,postApplicationLoading
are newly exposed on the returning object. This is helpful for consuming components.libs/api/domains/official-journal-of-iceland-application/src/lib/ojoiApplication.resolver.ts (1)
147-155
: Ensure error handling and test coverage for the new mutation.The
postApplication
mutation is straightforward. However, consider how errors or exceptions from the service are handled. Also ensure test coverage for various error cases.Would you like me to provide a sample unit test to validate the resolver’s behavior when
ojoiApplicationService.postApplication
throws an error?libs/application/templates/official-journal-of-iceland/src/fields/Submitted.tsx (2)
43-48
: New properties are properly destructured.Exposing
postApplication
,postApplicationError
, andpostApplicationLoading
extends your component’s submission logic. Looks good.
119-129
: Clear error handling for the postApplication process.Displaying an alert for
postApplicationError
helps inform the user about failure states. This approach is consistent with the existing UI patterns.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17411 +/- ##
==========================================
+ Coverage 35.66% 35.68% +0.01%
==========================================
Files 6936 6933 -3
Lines 148935 148841 -94
Branches 42559 42517 -42
==========================================
- Hits 53125 53109 -16
+ Misses 95810 95732 -78
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 12 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Datadog ReportAll test runs ✅ 4 Total Test Services: 0 Failed, 4 Passed Test Services
|
What
Allowing users to try to repost their application if it has failed.
Why
To allow users to post application if it has failed
Checklist:
Summary by CodeRabbit
Release Notes
New Features
Improvements
Bug Fixes
The update provides a more robust and user-friendly application submission experience with comprehensive error reporting and state management.