Skip to content

refactor(web): dedupe the repositories/jira/git-account error-message helper - #7122

Closed
pedrofrxncx wants to merge 1 commit into
mainfrom
refactor/dedupe-error-message-helper-w1
Closed

pedrofrxncx wants to merge 1 commit into
mainfrom
refactor/dedupe-error-message-helper-w1

Conversation

@pedrofrxncx

@pedrofrxncx pedrofrxncx commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Reduction found while auditing apps/web/src/views/settings/repositories.tsx (this tick's assigned area).

What: repositories.tsx, jira.tsx, and git-account-connect.tsx each hand-rolled an identical errorMessage(err, fallback) helper (extract a toast-friendly message from a caught error). Moved the single copy to apps/web/src/utils/error-message.ts and imported it in all three call sites.

Why a maintainer wants it: three copies of the same 1-line logic drifted — jira.tsx and git-account-connect.tsx returned err.message even when it was an empty string (showing a blank toast instead of falling back), while repositories.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/src shows a single definition; bunx tsc --noEmit in apps/web is unaffected (my touched files show no new errors — only a pre-existing unrelated prosemirror version-mismatch error remains); bunx oxlint on the 4 changed files is clean.

Locally ran: bun run fmt, cd apps/web && bunx tsc --noEmit (no errors in touched files), bunx oxlint on the 4 changed files (0 warnings/errors). Full CI validates the rest.

🤖 Generated with Claude Code


Summary by cubic

Consolidates the three identical errorMessage helpers in repositories.tsx, jira.tsx, and git-account-connect.tsx into one shared util at apps/web/src/utils/error-message.ts. The shared version falls back when err.message is empty, fixing a latent bug where jira and git-account-connect could 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.

Review in cubic

@github-actions github-actions Bot added the claude PR authored by a coding agent label Sep 9, 2026
@pedrofrxncx

Copy link
Copy Markdown
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]

@pedrofrxncx
pedrofrxncx deleted the refactor/dedupe-error-message-helper-w1 branch September 14, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude PR authored by a coding agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant