Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(code-block): Do not copy diff markers #12900

Merged
merged 2 commits into from
Mar 4, 2025
Merged

Conversation

s1gr1d
Copy link
Member

@s1gr1d s1gr1d commented Mar 3, 2025

DESCRIBE YOUR PR

Code blocks can contain diff markers (+ or -) at the beginning of code blocks which get copied as well when copying the code.

This modifies the function for copying code on click and adds an effect to handle copy-events initiated manually (not by clicking "copy code".

closes #12802

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

Copy link

vercel bot commented Mar 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
develop-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 4, 2025 0:16am
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 4, 2025 0:16am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
changelog ⬜️ Ignored (Inspect) Mar 4, 2025 0:16am

@s1gr1d s1gr1d requested review from a-hariti and chargome March 3, 2025 16:02
Copy link

codecov bot commented Mar 3, 2025

Bundle Report

Changes will increase total bundle size by 2.19kB (0.01%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-server-cjs 10.2MB 1.23kB (0.01%) ⬆️
sentry-docs-client-array-push 9.39MB 959 bytes (0.01%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: sentry-docs-server-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
1729.js -3 bytes 1.46MB -0.0%
../instrumentation.js -3 bytes 791.26kB -0.0%
9523.js -3 bytes 767.46kB -0.0%
../app/[[...path]]/page.js 1.24kB 531.96kB 0.23%

Files in ../app/[[...path]]/page.js:

  • ./src/components/codeBlock/index.tsx → Total Size: 5.18kB

  • ./src/components/codeBlock/index.tsx → Total Size: 1.3kB

App Routes Affected:

App Route Size Change Total Size Change (%)
/[[...path]] 1.24kB 3.08MB 0.04%
view changes for bundle: sentry-docs-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/chunks/pages/_app-*.js -3 bytes 868.04kB -0.0%
static/chunks/4028-*.js -3 bytes 393.29kB -0.0%
static/chunks/app/[[...path]]/page-*.js 965 bytes 73.98kB 1.32%
server/middleware-*.js -5.55kB 1.0kB -84.74%
server/middleware-*.js 5.55kB 6.55kB 555.3% ⚠️
static/5UR29uqX1JDZYalKVaOFX/_buildManifest.js (New) 578 bytes 578 bytes 100.0% 🚀
static/5UR29uqX1JDZYalKVaOFX/_ssgManifest.js (New) 77 bytes 77 bytes 100.0% 🚀
static/k8ujUP5XL1aiDc36MO9J-*.js (Deleted) -578 bytes 0 bytes -100.0% 🗑️
static/k8ujUP5XL1aiDc36MO9J-*.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️

Files in static/chunks/app/[[...path]]/page-*.js:

  • ./src/components/codeBlock/index.tsx → Total Size: 5.74kB

Copy link
Member

@chargome chargome left a comment

Choose a reason for hiding this comment

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

Generally looks good! You can add some small unit tests just for the effect functionality if you want – in case something with our diff block logic changes in the future

Copy link
Member

@chargome chargome left a comment

Choose a reason for hiding this comment

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

thanks for adding the tests 🙏

@s1gr1d s1gr1d merged commit 38ed82b into master Mar 4, 2025
13 checks passed
@s1gr1d s1gr1d deleted the sig/dont-copy-diff-markers branch March 4, 2025 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not copy diff symbols from code snippets
2 participants