refactor(web): dedupe the repositories/jira/git-account error-message helper - #7122
Closed
pedrofrxncx wants to merge 1 commit into
Closed
pedrofrxncx wants to merge 1 commit into
pedrofrxncx wants to merge 1 commit into
Conversation
Collaborator
Author
|
Closing as stale: this PR sat past the bot's 48h merge window, main has moved on, and its CI results no longer reflect the current base. This is a housekeeping close, not a rejection of the change — if the underlying problem still exists, the bot will find it again and open a fresh, rebased PR. [studio-bot:stale-close] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reduction found while auditing
apps/web/src/views/settings/repositories.tsx(this tick's assigned area).What:
repositories.tsx,jira.tsx, andgit-account-connect.tsxeach hand-rolled an identicalerrorMessage(err, fallback)helper (extract a toast-friendly message from a caught error). Moved the single copy toapps/web/src/utils/error-message.tsand imported it in all three call sites.Why a maintainer wants it: three copies of the same 1-line logic drifted —
jira.tsxandgit-account-connect.tsxreturnederr.messageeven when it was an empty string (showing a blank toast instead of falling back), whilerepositories.tsx's copy already guarded against that. Consolidating to the safer variant fixes that latent gap in the other two call sites for free.Net delta: -11 / +1 (three inline functions removed, one shared 4-line util added), imports otherwise unchanged. Behavior-preserving for all non-empty-message cases; the empty-message edge case in jira/git-account now degrades to the fallback string instead of a blank toast.
To verify:
rg "function errorMessage" apps/web/srcshows a single definition;bunx tsc --noEmitinapps/webis unaffected (my touched files show no new errors — only a pre-existing unrelated prosemirror version-mismatch error remains);bunx oxlinton the 4 changed files is clean.Locally ran:
bun run fmt,cd apps/web && bunx tsc --noEmit(no errors in touched files),bunx oxlinton the 4 changed files (0 warnings/errors). Full CI validates the rest.🤖 Generated with Claude Code
Summary by cubic
Consolidates the three identical
errorMessagehelpers inrepositories.tsx,jira.tsx, andgit-account-connect.tsxinto one shared util atapps/web/src/utils/error-message.ts. The shared version falls back whenerr.messageis empty, fixing a latent bug wherejiraandgit-account-connectcould show a blank toast instead of the fallback string; all other cases behave the same.Written for commit 6acdffd. Summary will update on new commits.