Skip to content

helpers/qrCode: Adapt to qr-code-styling 1.9.2 internals#4

Merged
teidesu merged 1 commit into
masterfrom
poli-qr-code-styling-fix
Jun 17, 2026
Merged

helpers/qrCode: Adapt to qr-code-styling 1.9.2 internals#4
teidesu merged 1 commit into
masterfrom
poli-qr-code-styling-fix

Conversation

@poli0iq

@poli0iq poli0iq commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Fixes a regression introduced in cac7c9a (which bumped qr-code-styling from 1.5.0 to 1.9.2): renames in the library internals caused QR sign-in to crash with "Cannot read properties of undefined".

Await "_canvasDrawingPromise" instead, and require 1.9.2 at min since the changes are not backward compatible.

Summary by CodeRabbit

  • Bug Fixes

    • Improved QR code rendering reliability by better detecting when the QR canvas has finished drawing before proceeding.
  • Chores

    • Updated the QR code styling library to a newer compatible version.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b83a93e2-da3d-4e3c-8eff-a49b2a63f3d8

📥 Commits

Reviewing files that changed from the base of the PR and between 3362269 and 09b0190.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • package.json
  • src/helpers/qrCode/paintQrCode.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • package.json
  • src/helpers/qrCode/paintQrCode.ts

📝 Walkthrough

Walkthrough

Bumps the qr-code-styling dev dependency from ^1.5.0 to ^1.9.2. In paintQrCode, the drawing-completion wait is replaced with a Promise.race between a 1-second timeout and the library's new _canvasDrawingPromise internal property, falling back to an already-resolved promise if that property is absent.

Changes

QR code library upgrade and rendering wait logic

Layer / File(s) Summary
Dependency bump and drawing-completion wait update
package.json, src/helpers/qrCode/paintQrCode.ts
qr-code-styling devDependency is raised to ^1.9.2. paintQrCode drops the old _drawingPromise / _canvas._image load-event listener path and replaces it with Promise.race(pause(1000), qrCode._canvasDrawingPromise ?? Promise.resolve()).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇 A QR code waits in the dark,
Till _canvasDrawingPromise leaves its mark.
No image load, no canvas fuss—
Just a race with a pause, no more to discuss!
Hop hop, the pixels align,
Version nine-point-two is looking fine! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adapting helper code to work with qr-code-styling 1.9.2's refactored internals due to breaking API changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch poli-qr-code-styling-fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@poli0iq poli0iq marked this pull request as ready for review June 17, 2026 15:02

@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 `@package.json`:
- Line 62: The qr-code-styling package dependency is specified with a caret
version (^1.9.2) which allows minor and patch version upgrades, but the code
relies on the private/undocumented field _canvasDrawingPromise which is not part
of the public API and may change in future versions. Pin the dependency to an
exact version by removing the caret and changing it to 1.9.2. Additionally,
consider refactoring the code that depends on _canvasDrawingPromise to use
documented public methods from the qr-code-styling library (such as getRawData()
or download()) to make the implementation more robust against future library
changes.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: d9881956-0e94-4c46-8f7b-a39b36c8b3d2

📥 Commits

Reviewing files that changed from the base of the PR and between 169cf98 and 3362269.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • package.json
  • src/helpers/qrCode/paintQrCode.ts

Comment thread package.json Outdated
Fixes a regression introduced in cac7c9a (which bumped qr-code-styling
from 1.5.0 to 1.9.2): renames in the library internals caused QR sign-in
to crash with "Cannot read properties of undefined".

Await _canvasDrawingPromise instead, and require 1.9.2 because we're
using a private property.
@poli0iq poli0iq force-pushed the poli-qr-code-styling-fix branch from 3362269 to 09b0190 Compare June 17, 2026 16:32
@poli0iq poli0iq requested a review from teidesu June 17, 2026 16:50
@teidesu teidesu merged commit 41dd07b into master Jun 17, 2026
3 checks passed
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.

2 participants