-
Notifications
You must be signed in to change notification settings - Fork 24
Qrcode img #711
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
Qrcode img #711
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the StyledQRCode component to render QR codes as <img> elements instead of <div> elements to enable better copying and sharing functionality. The change involves generating QR code data as blobs, converting them to object URLs, and using those URLs as the image source.
Key changes:
- Converted from DOM manipulation (appending to div) to async blob-based rendering with img element
- Added blob-to-URL conversion utility and state management for image source
- Consolidated two separate useEffect hooks into one for QR code generation and updates
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/components/StyledQrCode.tsx
Outdated
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [type, shape, width, height, margin, data, restKey, mimeType]); |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The eslint-disable-next-line react-hooks/exhaustive-deps comment is used to suppress warnings about missing dependencies, but some dependencies (qrOptions, imageOptions, dotsOptions, backgroundOptions) are genuinely missing from the dependency array.
Instead of disabling the rule, either:
- Add all the missing dependencies to the array, or
- Add a comment explaining why specific dependencies are intentionally omitted (though in this case they should not be omitted)
This disable comment may be masking the real issue identified in the earlier comment about missing dependencies.
| // eslint-disable-next-line react-hooks/exhaustive-deps | |
| }, [type, shape, width, height, margin, data, restKey, mimeType]); | |
| }, [type, shape, width, height, margin, data, qrOptions, imageOptions, dotsOptions, backgroundOptions, restKey, mimeType]); |
|
lol |
To support copying and sharing qrcodes use an
imgelement instead ofdivhttps://discord.com/channels/1220144003874553986/1220144004826533900/1444655547067535522