Skip to content

fix: guard against undefined accessor in printScale#875

Merged
techniq merged 2 commits into
techniq:nextfrom
ruizdiazever:fix/debug-printscale-undefined-accessor
Jun 4, 2026
Merged

fix: guard against undefined accessor in printScale#875
techniq merged 2 commits into
techniq:nextfrom
ruizdiazever:fix/debug-printscale-undefined-accessor

Conversation

@ruizdiazever

Copy link
Copy Markdown
  • Guard acc param in printScale to prevent crash when z or r scales are not configured but included in activeGetters

activeGetters always includes x, y, z, and r (see chart.svelte.ts:617), but when z or r are not configured, the accessor is undefined, causing acc.toString() to throw:

TypeError: can't access property "toString", acc is undefined
    printScale debug.ts:72
    printDebug debug.ts:100

Fix: add if (acc != null) guard before calling acc.toString().

When activeGetters includes z or r scales that are not configured, the accessor is undefined, causing acc.toString to throw. Added null check.
@changeset-bot

changeset-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 73feefe

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
layerchart Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jun 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/layerchart@875

commit: 73feefe

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
layerchart ✅ Ready (View Log) Visit Preview 73feefe

@ruizdiazever

Copy link
Copy Markdown
Author
Screenshot 2026-06-04 at 09 28 55

@techniq

techniq commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Thanks @ruizdiazever. Care to add a changeset (pnpm changeset) and I'll cut a release with this change.

Not sure why the bundle analysis CI failed, might be a permission issue. I'm taking a look.

@ruizdiazever

Copy link
Copy Markdown
Author

Done! Added the changeset as a patch level change. Thank you for maintaining this awesome library!

@techniq techniq merged commit c232fe3 into techniq:next Jun 4, 2026
7 of 8 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 4, 2026
@techniq

techniq commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Released as 2.0.0-next.65. Thanks again!

@techniq

techniq commented Jun 4, 2026

Copy link
Copy Markdown
Owner

This should fix the bundle analysis CI (hopefully) for next time: #877

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