fix: only show error in claim package modal if checkResult is null#1199
fix: only show error in claim package modal if checkResult is null#1199danielroe merged 22 commits intonpmx-dev:mainfrom
Conversation
…ackage manager handling
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
📝 WalkthroughWalkthroughThe error handling logic in the 🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
| const mergedError = computed(() => { | ||
| return ( | ||
| publishError.value ?? | ||
| (checkError.value instanceof Error | ||
| ? checkError.value.message | ||
| : $t('claim.modal.failed_to_check')) | ||
| ) | ||
| return checkResult.value !== null | ||
| ? null | ||
| : (publishError.value ?? | ||
| (checkError.value instanceof Error | ||
| ? checkError.value.message | ||
| : $t('claim.modal.failed_to_check'))) |
There was a problem hiding this comment.
Publish errors are now hidden once a check result exists.
Line 39 short-circuits mergedError to null whenever checkResult.value is non-null, which means publishError will never be displayed after a failed claim. Users lose feedback on publish failures. Prioritise publishError first, then suppress only check errors once a result exists.
Proposed fix
const mergedError = computed(() => {
- return checkResult.value !== null
- ? null
- : (publishError.value ??
- (checkError.value instanceof Error
- ? checkError.value.message
- : $t('claim.modal.failed_to_check')))
+ if (publishError.value) return publishError.value
+ if (checkResult.value !== null) return null
+ return checkError.value instanceof Error
+ ? checkError.value.message
+ : $t('claim.modal.failed_to_check')
})📝 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.
| const mergedError = computed(() => { | |
| return ( | |
| publishError.value ?? | |
| (checkError.value instanceof Error | |
| ? checkError.value.message | |
| : $t('claim.modal.failed_to_check')) | |
| ) | |
| return checkResult.value !== null | |
| ? null | |
| : (publishError.value ?? | |
| (checkError.value instanceof Error | |
| ? checkError.value.message | |
| : $t('claim.modal.failed_to_check'))) | |
| const mergedError = computed(() => { | |
| if (publishError.value) return publishError.value | |
| if (checkResult.value !== null) return null | |
| return checkError.value instanceof Error | |
| ? checkError.value.message | |
| : $t('claim.modal.failed_to_check') | |
| }) |
The claim package modal has a default error message that persists even after the package name is validated.
This pull checks if the checkResult variable is null before presenting the mergedError message