Skip to content

React charts leftovers#1604

Merged
damyanpetev merged 2 commits intomasterfrom
dpetev/react-charts-leftovers
Apr 2, 2026
Merged

React charts leftovers#1604
damyanpetev merged 2 commits intomasterfrom
dpetev/react-charts-leftovers

Conversation

@damyanpetev
Copy link
Copy Markdown
Member

Small addition to #1598 where we discarded the effect approach. Actual clean approach is with state and works just fine

  const [legend, setLegend] = useState(null);
  ...
  <IgrItemLegend ref={setLegend} />
  <IgrDoughnutChart>
          <IgrRingSeries
            legend={legend}
          ></IgrRingSeries>

https://codesandbox.io/p/devbox/brave-wescoff-mrkqy2?file=%2Fsrc%2Findex.tsx%3A38%2C9-51%2C28

Copilot AI review requested due to automatic review settings April 2, 2026 14:55
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 2, 2026

Coverage Status

coverage: 86.103%. remained the same
when pulling b145245 on dpetev/react-charts-leftovers
into adf3ed8 on master.

@damyanpetev damyanpetev requested review from Hristo313 and kdinev April 2, 2026 14:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the igr-ts React chart templates to remove the previous useEffect/useRef approach and instead initialize chart data via useState, while wiring chart legends through state-set refs.

Changes:

  • Replace useEffect-initialized chart data with useState(data) initialization in several chart templates.
  • Replace useRef legend wiring with a state-driven legend instance set via ref.
  • Add a React template-related entry to the changelog (currently mismatched with the actual PR changes).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/cli/templates/react/igr-ts/pie-chart/default/files/src/app/path/filePrefix.tsx Switches legend wiring to state and removes useEffect/useRef usage.
packages/cli/templates/react/igr-ts/doughnut-chart/default/files/src/app/path/filePrefix.tsx Switches legend wiring to state and removes useEffect/useRef usage.
packages/cli/templates/react/igr-ts/financial-chart/default/files/src/app/path/filePrefix.tsx Initializes chart data directly from useState(data) instead of an effect.
packages/cli/templates/react/igr-ts/category-chart/default/files/src/app/path/filePrefix.tsx Initializes chart data directly from useState(data) instead of an effect.
CHANGELOG.md Adds a React template bullet (currently describing Vite@8 rather than the chart-template changes in this PR).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

damyanpetev and others added 2 commits April 2, 2026 18:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@damyanpetev damyanpetev merged commit 8a333b3 into master Apr 2, 2026
7 checks passed
@damyanpetev damyanpetev deleted the dpetev/react-charts-leftovers branch April 2, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants