Skip to content

fix: avoid Alpine SVG template rendering errors in cost charts#1004

Closed
lc-soft wants to merge 1 commit intoRightNow-AI:mainfrom
lc-soft:fix/analytics-svg-rendering-errors
Closed

fix: avoid Alpine SVG template rendering errors in cost charts#1004
lc-soft wants to merge 1 commit intoRightNow-AI:mainfrom
lc-soft:fix/analytics-svg-rendering-errors

Conversation

@lc-soft
Copy link
Copy Markdown
Contributor

@lc-soft lc-soft commented Apr 7, 2026

Summary

This PR fixes chart rendering issues caused by Alpine directives inside SVG templates. In the analytics cost dashboard, SVG-based donut and bar charts could fail to render correctly (including runtime expression/import errors), which resulted in broken or incomplete chart visuals.

screenshot-20260407-160312 screenshot-20260407-160302 screenshot-20260407-160239 screenshot-20260407-160225

Changes

  • Replaced SVG <template x-for> loops with x-html-based rendering for chart segments/bars.
  • Added JS helper functions to generate SVG markup for donut and daily bar charts.
  • Preserved existing chart behavior and data sources (colors, labels, tooltips, percentages, totals).
  • Added XML escaping for generated SVG text/attributes to improve rendering safety and stability.

Testing

  • cargo clippy --workspace --all-targets -- -D warnings passes
  • cargo test --workspace passes
  • Live integration tested (if applicable)

Security

  • No new unsafe code
  • No secrets or API keys in diff
  • User input validated at boundaries

@lc-soft lc-soft closed this Apr 8, 2026
@lc-soft lc-soft deleted the fix/analytics-svg-rendering-errors branch April 8, 2026 06:36
@lc-soft lc-soft restored the fix/analytics-svg-rendering-errors branch April 8, 2026 06:36
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.

1 participant