Skip to content

[Bug]: Copy Rewrite buttons do not copy suggestions - #1925

Open
kumud-05 wants to merge 1 commit into
Canopus-Labs:mainfrom
kumud-05:fix/copy-rewrite-button
Open

[Bug]: Copy Rewrite buttons do not copy suggestions#1925
kumud-05 wants to merge 1 commit into
Canopus-Labs:mainfrom
kumud-05:fix/copy-rewrite-button

Conversation

@kumud-05

@kumud-05 kumud-05 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

📝 Pull Request Description

Related Issue

Closes #1924

Summary

Implemented clipboard functionality for the "Copy Rewrite" buttons in the Resume Bullet Enhancer.

Each rewrite suggestion can now be copied directly to the clipboard by clicking its corresponding "Copy Rewrite" button.


Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature
  • ♻️ Refactoring
  • 📝 Documentation update
  • 🎨 UI/UX improvement
  • 🔥 Other(please describe) ______

How Has This Been Tested?

Describe the testing steps performed.

  • Opened the Resume Bullet Enhancer page and navigated to the "AI Rewrite Suggestions" section.
  • Clicked each "Copy Rewrite" button and verified that the corresponding suggestion was copied successfully to the clipboard.
  • Pasted the copied content into a text editor to verify the correct rewrite was copied.

Checklist

  • My code follows the project's guidelines
  • I have tested my changes
  • I have updated documentation where necessary
  • I have linked the related issue
  • My changes do not introduce new warnings or errors

Summary

  • Fixed the “Copy Rewrite” buttons in the Resume Bullet Enhancer.
  • Each button now copies its corresponding AI rewrite suggestion by using navigator.clipboard.writeText.
  • Preserved the existing button labels and styling.
  • Manually verified clipboard behavior for each button.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Rewrite option buttons on the Resume Bullet Enhancer page now copy their associated rewrite text to the clipboard when clicked.

Changes

Resume rewrite clipboard

Layer / File(s) Summary
Connect rewrite buttons to clipboard
frontend/src/pages/ResumeBulletEnhancer/ResumeBulletEnhancer.jsx
Each rewrite option button now calls navigator.clipboard.writeText with its associated rewrite text.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: jainiksha

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the bug fixed by the pull request: Copy Rewrite buttons do not copy suggestions.
Linked Issues check ✅ Passed The change connects each Copy Rewrite button to navigator.clipboard.writeText for its corresponding rewrite suggestion, satisfying issue #1924.
Out of Scope Changes check ✅ Passed The changes are limited to clipboard functionality for the Resume Bullet Enhancer rewrite buttons and contain no unrelated work.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/pages/ResumeBulletEnhancer/ResumeBulletEnhancer.jsx`:
- Around line 274-275: Update the button’s inline copy handler in
ResumeBulletEnhancer to use an async try/catch flow around
navigator.clipboard.writeText(text), handling rejected writes and unavailable
Clipboard API without unhandled errors. Reuse the existing clipboard failure and
user-feedback pattern from QuestionCard.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cc743de9-e1fc-4e13-8ec3-0a8867206283

📥 Commits

Reviewing files that changed from the base of the PR and between 206d384 and 6cf82bb.

📒 Files selected for processing (1)
  • frontend/src/pages/ResumeBulletEnhancer/ResumeBulletEnhancer.jsx

Comment on lines +274 to +275
<button
onClick={() => navigator.clipboard.writeText(text)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- target file ---'
sed -n '250,290p' frontend/src/pages/ResumeBulletEnhancer/ResumeBulletEnhancer.jsx

printf '%s\n' '--- existing clipboard handling ---'
sed -n '1,70p' frontend/src/components/Cards/QuestionCard.jsx

printf '%s\n' '--- clipboard usage ---'
rg -n -C 3 'navigator\.clipboard|writeText' frontend/src

Repository: Canopus-Labs/PrepPilot

Length of output: 7783


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- ResumeBulletEnhancer imports and handlers ---'
sed -n '1,110p' frontend/src/pages/ResumeBulletEnhancer/ResumeBulletEnhancer.jsx

printf '%s\n' '--- existing copy error handling ---'
sed -n '65,90p' frontend/src/pages/ProblemSolver/ProblemSolver.jsx
sed -n '355,380p' frontend/src/pages/NotesSummarizer/NotesSummarizer.jsx

printf '%s\n' '--- toast setup in the target page ---'
rg -n -C 2 'react-hot-toast|toast\.' frontend/src/pages/ResumeBulletEnhancer/ResumeBulletEnhancer.jsx frontend/src

Repository: Canopus-Labs/PrepPilot

Length of output: 41904


🏁 Script executed:

#!/bin/bash
set -eu

node - <<'JS'
const events = [];
process.on("unhandledRejection", (reason) => events.push(`unhandled:${reason.message}`));

global.navigator = {
  clipboard: {
    writeText: () => Promise.reject(new Error("permission denied")),
  },
};

const handler = () => navigator.clipboard.writeText("text");
const returned = handler();

if (!(returned instanceof Promise)) throw new Error("handler did not return the clipboard Promise");

setImmediate(() => {
  if (!events.includes("unhandled:permission denied")) {
    throw new Error(`expected an unhandled rejection, got ${JSON.stringify(events)}`);
  }
  console.log("rejected write is unhandled when the returned Promise is ignored");
});
JS

Repository: Canopus-Labs/PrepPilot

Length of output: 844


🏁 Script executed:

#!/bin/bash
set -eu

node - <<'JS'
const events = [];
process.on("unhandledRejection", (reason) => events.push(`unhandled:${reason.message}`));

Object.defineProperty(globalThis, "navigator", {
  configurable: true,
  value: {
    clipboard: {
      writeText: () => Promise.reject(new Error("permission denied")),
    },
  },
});

const handler = () => navigator.clipboard.writeText("text");
const returned = handler();

if (!(returned instanceof Promise)) throw new Error("handler did not return the clipboard Promise");

setImmediate(() => {
  if (!events.includes("unhandled:permission denied")) {
    throw new Error(`expected an unhandled rejection, got ${JSON.stringify(events)}`);
  }
  console.log("rejected write is unhandled when the returned Promise is ignored");
});
JS

Repository: Canopus-Labs/PrepPilot

Length of output: 225


Handle clipboard failures.

Wrap the copy operation in an async handler with try/catch. A rejected navigator.clipboard.writeText(text) is currently unhandled, and an unavailable Clipboard API causes an error without user feedback. Reuse the existing pattern from frontend/src/components/Cards/QuestionCard.jsx.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/pages/ResumeBulletEnhancer/ResumeBulletEnhancer.jsx` around
lines 274 - 275, Update the button’s inline copy handler in ResumeBulletEnhancer
to use an async try/catch flow around navigator.clipboard.writeText(text),
handling rejected writes and unavailable Clipboard API without unhandled errors.
Reuse the existing clipboard failure and user-feedback pattern from
QuestionCard.

@github-actions github-actions Bot added the merge ready PR is mergeable and has no conflicts label Aug 12, 2026
@KaranUnique

Copy link
Copy Markdown
Contributor

@kumud-05 Address the coderabbit suggestion, wrap the copy operation with try catch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge ready PR is mergeable and has no conflicts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]:Copy Rewrite buttons do not copy generated suggestions

2 participants