Commit e7ec0ec
authored
fix(frontend): handle copy repo clipboard failures (JhaSourav07#2984)
## Description
Fixes JhaSourav07#2983
## Pillar
- [x] 🛠️ Other (Bug fix, refactoring, docs)
## What changed
`CopyRepoButton` previously awaited
`navigator.clipboard.writeText(repoUrl)` without catching failures. If
the browser rejected the clipboard write, the async click handler failed
and the button gave no feedback.
This PR adds an explicit copy state:
- `Copied!` is shown only after the clipboard write resolves
- `Copy failed` is shown briefly when the clipboard write rejects
- the button returns to `Copy URL` after the same short reset window
I also added focused tests for both successful and rejected clipboard
writes while keeping the existing render-scaling coverage.
## Visual Preview
N/A - small button state behavior fix.
## Local verification
- `npm run test --
app/components/CopyRepoButton.massive-scaling.test.tsx` passed
- `npm run format:check` passed
- `npm run lint` passed with one existing warning outside this change
- `npm run typecheck` passed
- `npm run test` passed: 119 files, 1775 passed, 1 expected fail
- `npm run build` still fails locally with the existing opaque webpack
error; no file-level diagnostics were emitted, and recent CI production
builds for this repo have passed despite the same local behavior
## GSSoC 2026
This issue and PR are raised under GSSoC 2026. Please add the relevant
GSSoC/level labels if they do not sync from the issue automatically.
## Checklist before requesting a review:
- [x] I have read the `CONTRIBUTING.md` file.
- [x] I have tested these changes locally
(`localhost:3000/api/streak?user=YOUR_USERNAME`).
- [x] I have run `npm run format` / `npm run format:check` and `npm run
lint` locally.
- [x] I have run `npm run test` locally.
- [x] My commits follow the Conventional Commits format.
- [x] I have updated `README.md` if I added a new theme or URL
parameter.
- [x] I have starred the repo.
- [x] I have made sure that I have only one commit to merge in this PR.
- [x] The SVG output matches the CommitPulse quality standard.2 files changed
Lines changed: 51 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
9 | 18 | | |
10 | 19 | | |
11 | 20 | | |
| |||
63 | 72 | | |
64 | 73 | | |
65 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
66 | 106 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
13 | 18 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
0 commit comments