project-nv / night-vision

Highly customizable charting library, created for professional traders
https://nightvision.dev
MIT License
250 stars 58 forks source link

Render/Input bug when using event listeners #41

Closed Swoorup closed 1 year ago

Swoorup commented 1 year ago

Describe the bug

When subscribing to events i.e

chart.events.on("chart:range-changed", (event) => {
  const dataStart = data.panes[0].overlays[0].data[0][0];
  const from = event[0];
  const to = event[1];
  console.log(
    `DataStart: ${new Date(dataStart).toUTCString()}, ViewStart: ${new Date(
      from
    ).toUTCString()}, ViewEnd: ${new Date(to).toUTCString()}`
  );
});

It appears that NV chart becomes buggy:

Reproduction

https://codesandbox.io/s/playing-around-4-forked-fkl33n?from-embed=&file=/main.js:601-933

Steps to reproduce

No response

Javascript Framework

no-framework (vanilla-js)

Logs

night-vision.js:6413 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
add @ night-vision.js:6413
onEvent @ night-vision.js:6386
listeners @ night-vision.js:6568
setup @ night-vision.js:6555
attach @ night-vision.js:7315
(anonymous) @ night-vision.js:7678

Validations

C451 commented 1 year ago

Should be "app:$range-update". Each event component should have a unique name

Swoorup commented 1 year ago

You are right, I am closing this.