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

3.1.3 dataset.data reload when doing push() #108

Closed
1 of 4 tasks
aguegu opened this issue Mar 9, 2022 · 10 comments
Closed
1 of 4 tasks

3.1.3 dataset.data reload when doing push() #108

aguegu opened this issue Mar 9, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@aguegu
Copy link

aguegu commented Mar 9, 2022

Describe the bug

simplescreenrecorder-2022-03-09_11.05.49.mp4

As shown in the video, each data.push() action would trigger a full reload by the animation.

3.1.3 is related to #58 , I think the cause of this problem is the cloneDeep() of data array. So each update/render is a full reload in 3.1.3

To Reproduce

Put a reproduction link here based on this templates

Version of vue-chart-3

3.1.3

Version of Vue

  • Vue 3
  • Vue 2
  • Nuxt 2
  • Nuxt 3
@aguegu
Copy link
Author

aguegu commented Mar 9, 2022

In 3.1.2, the animation only applied to the newly pushed data. And I think it is what to expect.

simplescreenrecorder-2022-03-09_11.07.52.mp4

@victorgarciaesgi
Copy link
Owner

I thanks for the report, looks like a rushed a little on this update. I will look at it. cloneDeep happens only if the size of the array haven't changed (Chart.js using Proxies too, I think that's was what causing the bug)

@victorgarciaesgi victorgarciaesgi added the bug Something isn't working label Mar 9, 2022
@victorgarciaesgi
Copy link
Owner

Do you reproduce it on the demo ? https://codesandbox.io/s/demo-vue-chart-3-ugynm?file=/src/App.vue

@aguegu
Copy link
Author

aguegu commented Mar 9, 2022

To reproduce it is not hard. You may create a line chart with options

scales: {
    x: {
      type: 'time',
      display: false,
    },
    y: {
      title: {
        display: true,
        text: 'value',
      },
    },
  },

and push data point to it

datasets[0].data.push({ x: Date.now(), y: Math.random() });

within a setInterval() callback.

Hope it would help.

@GijsGoudzwaard
Copy link

I have the same issue with both a line chart and bar chart. I'm using vue-chart-3 3.1.4 and vue 3.2.31. For now downgrading to 3.0.9 fixes it (npm i [email protected])

@victorgarciaesgi
Copy link
Owner

Yeah, it seems like the fix I added broke the animations. I need to take a time but this week it's going to be hard

@victorgarciaesgi
Copy link
Owner

Guys I'm so sorry. I just found out that when using deep: true using watch in Vue 3, the oldValue and newValue will be the same....
That's what messed with all the animations and updates

image

@victorgarciaesgi
Copy link
Owner

Currently finding out a way to compare new and old values

@victorgarciaesgi
Copy link
Owner

Should be fixed in 3.1.5. Sorry again

@GijsGoudzwaard
Copy link

No worries, can confirm that this is fixed in 3.1.5

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

No branches or pull requests

3 participants