Commit 6eed39f
authored
fix(frontend): handle dashboard share clipboard failures (JhaSourav07#3037)
## Description
Fixes JhaSourav07#3036
## Pillar
- [x] 🛠️ Other (Bug fix, refactoring, docs)
## What changed
The dashboard Share button was calling
`navigator.clipboard.writeText(window.location.href)` without awaiting
the returned promise, then immediately showing `Link copied to
clipboard!`.
That meant browsers could reject the clipboard write while the UI still
reported success. I changed that handler to await the clipboard write,
show the success toast only after it resolves, and show an error toast
when copying fails.
I also added focused `DashboardClient` tests for both outcomes:
- successful dashboard link copy
- rejected clipboard write due to permission/browser failure
Opened as part of GSSoC 2026.
## Visual Preview
N/A — this is a dashboard interaction/error-handling fix.
## Validation
- [x] `npm run format`
- [x] `npm run format:check`
- [x] `npm run lint`
- [x] `npm run typecheck`
- [x] `npm run test -- components/dashboard/DashboardClient.test.tsx`
- [x] `npm run test`
## 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` and `npm run lint` locally and
resolved all errors.
- [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: 60 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
18 | 27 | | |
19 | 28 | | |
20 | 29 | | |
| |||
205 | 214 | | |
206 | 215 | | |
207 | 216 | | |
| 217 | + | |
208 | 218 | | |
209 | 219 | | |
210 | 220 | | |
| |||
327 | 337 | | |
328 | 338 | | |
329 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
330 | 380 | | |
331 | 381 | | |
332 | 382 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
480 | 489 | | |
481 | 490 | | |
482 | 491 | | |
| |||
610 | 619 | | |
611 | 620 | | |
612 | 621 | | |
613 | | - | |
614 | | - | |
615 | | - | |
616 | | - | |
| 622 | + | |
617 | 623 | | |
618 | 624 | | |
619 | 625 | | |
| |||
0 commit comments