types: fix issues in lib/core and Mark + Plot#491
Conversation
✅ Deploy Preview for svelteplot ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-491
# or install the specific version
npm install svelteplot@0.10.3-pr-491.0 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 93c64e7268
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| facetWidth: facetWidth ?? undefined, | ||
| facetHeight: facetHeight ?? undefined, |
There was a problem hiding this comment.
Keep facet dimensions numeric in initial plot state
Coalescing facetWidth/facetHeight to undefined here makes the initial PlotState carry non-numeric dimensions until updateDimensions runs. Several mark components immediately do arithmetic with these fields (for example Math.round(plot.facetWidth / tickSpacing) in AxisX.svelte and coordinate sums like marginLeft + plot.facetWidth), so first render—and SSR where effects do not execute—can yield NaN ticks/coordinates and missing SVG output. Preserve numeric defaults (e.g. 0) in computePlotState instead of undefined.
Useful? React with 👍 / 👎.
Fixes svelte-check errors in the core plot infrastructure files.
Changes
src/lib/Mark.svelte—as anycasts for dynamic channel/property indexing, structural type fix forMarkgeneric, null-safe record initialization, correctedresolveChannelandprojectXYcall signaturessrc/lib/core/Plot.svelte—(error as Error).messagein catch blocks, null-coalescing for nullable numeric fields, casts for dynamic scale key indexing andmergeDeepargssrc/lib/core/FacetAxes.svelte—fxValues as string[]forscaleBanddomain, casts fortickFormatandscaleFn, handleaxis === 'both'anchor casesrc/lib/core/FacetGrid.svelte—fxValues as string[],fyValues as string[],facetX as string,facetY as stringsrc/lib/Plot.svelte—projection as anyfor.typeaccess, casts for string scale key indexing,null→undefinedfor snippet props,(error as Error).messagesrc/lib/types/plot.ts— type improvements to support the above fixesresolves #407
resolves #408
resolves #410
resolves #411
resolves #412
🤖 Generated with Claude Code