Fix TypeError in insertNode and Add Configurable Bar Width for Bar Charts #6117
+78
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📑 Fix Node Shape Validation and Add Configurable Bar Width Feature
This PR addresses two key issues:
Fix for Node Shape Validation (Issue #1234)
Resolved a TypeError: Cannot read properties of undefined (reading 'shape') when a node without a shape property is passed to the insertNode function.
Solution:
Added a validation check for the shape property before referencing it in rendering-elements/nodes.ts. The new logic ensures that node.shape is validated before usage, preventing uncaught exceptions and enhancing the robustness of the rendering process.
Configurable Bar Width for Bar Charts (Issue #5678)
Added support for customizable bar widths in bar charts, allowing users to define fixed widths or control spacing to let bars fill the available space.
Solution:
Implemented a new customBarWidth property in the BarPlot class. This provides flexibility for users to set specific bar widths or rely on dynamic calculations for default behavior.
Resolves #1234 and #5678
📏 Design Decisions
Implementation:
Tests Added:
📋 Tasks
Make sure you
MERMAID_RELEASE_VERSION
is used for all new features.pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.