Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onRenderChange not called on chart resize #2221

Closed
drewdaemon opened this issue Oct 30, 2023 · 1 comment · Fixed by #2228
Closed

onRenderChange not called on chart resize #2221

drewdaemon opened this issue Oct 30, 2023 · 1 comment · Fixed by #2228
Assignees
Labels
bug Something isn't working

Comments

@drewdaemon
Copy link
Contributor

drewdaemon commented Oct 30, 2023

Describe the issue
When a chart is resized with no configuration changes, onRenderChange fails to fire leaving no way for a consumer to detect the rerender.

To Reproduce
Steps to reproduce the behavior:

  1. Create a chart and instrument onRenderChange with a console statement
  2. Resize the chart canvas (resizing the browser works)

See https://codesandbox.io/s/focused-rubin-n6s97f?file=/src/App.tsx

The chart resizes, but the onRenderChange isn't called.

Screen.Recording.2023-11-02.at.10.31.09.AM.mp4
@nickofthyme
Copy link
Collaborator

So after playing around with this a bit I noticed that the onRenderChange callback is not necessarily coupled directly with when the canvas is re-rendered.

Below you see console logs for a simple single series area chart from refresh. The logs are on the onRenderChange and the internal render to canvas function.

Current

image

With proposed changes

image

Here onRenderChange is initially called 5 time with rendered === false, then draws to canvas, then resized (which now sets the rendered state to false), Then something changes the state to true, the chart renders to canvas, the rendered false and rendered true.

I think this is badly in need of a cleanup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants