Conversation
## Summary - Add optional `initialWidth` prop to all SVG-based chart components (Line, Bar, StackedArea, Pie, Scatter, Composed, Funnel, Waterfall, Sankey, SparklineBar) to enable server-side rendering via `renderToStaticMarkup` - Update the shared `useResizeWidth` hook to accept an `initialWidth` fallback — used when no `ResizeObserver` measurement is available (e.g. Node.js environments), with the observer taking over seamlessly on the client - Rename the existing partial `width` prop on LineChart and BarChart to `initialWidth` for consistent semantics across all charts ## Motivation Charts currently render with 0 width in Node.js because `ResizeObserver` is unavailable. This blocks the Lighthouse team's pipeline for generating chart PNGs for Slack: `renderToStaticMarkup` → SVG string → `sharp`/`resvg` → PNG. The `initialWidth` prop provides a pre-measurement fallback with zero breaking changes — existing consumers are unaffected. ## Test plan - [x] Unit tests added for `useResizeWidth` fallback behavior (4 new tests) - [x] `initialWidth` added to Line and BarGrouped Storybook args for discoverability - [x] `yarn build` passes - [x] `yarn test:unit` passes (420 tests, 7 files) - [x] `yarn lint` passes (0 errors) - [x] `yarn format` passes Made with [Cursor](https://cursor.com) GitOrigin-RevId: c7671c95535be6ce26fa402e03a0db4533265822
|
The following public packages have changed files:
There is 1 existing changeset for this branch. If additional changes have been made that require different versions for any package simply add another changeset. Any packages that depend on the planned releases will be updated and released automatically in a separate PR. Each changeset corresponds to an update in the CHANGELOG for the packages listed in the changeset. Therefore, you should add a changeset for each noteable package change that this PR contains. For example, if a PR adds two features - one feature for packages A and B and one feature for package C - you should add two changesets. One changeset for packages A and B and one changeset for package C, with a description of each feature. The feature description will end up being the CHANGELOG entry for the packages in the changeset. The following releases are planned based on the existing changesets:
Last updated by commit 75fbf51 |
initialWidth prop to Origin charts for SSR support
## Summary
- Add optiUpdate public `js` sources with the latest code from the [public repository](https://github.com/lightsparkdev/js-sdk) main branch. This typically happens when new versions of the SDK are released and version updates need to be synced. The PR should be merged as soon as possible to avoid updates to webdev overwriting the changes in the js-sdk develop branch. --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Corey Martin <coreyn.martin@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Lightspark Eng <engineering@lightspark.com> GitOrigin-RevId: e763d6e6bed19b342e4c7b58a3d91a1a2cc8a71c
If this change should result in new package versions please add a changeset before merging. You can do so by clicking the link provided by changeset bot below.