Skip to content

Container component mouse events / tooltip stopped working after upgrading react 18 -> 19 #3048

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

Open
2 tasks done
heinibee1 opened this issue Feb 18, 2025 · 3 comments
Open
2 tasks done
Labels
Type: Bug 🐛 Oh no! A bug or unintentional behavior

Comments

@heinibee1
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Victory version

37.3.6

Code Sandbox link

https://codesandbox.io/p/sandbox/victory-starter-forked-zfh44g?file=%2Fsrc%2FChart.tsx%3A7%2C18

Bug report

Before I was able to drag the chart and tooltip would pop out when nearing the scatter. Also scatters would grow in size when they because "active". After Upgrading to react 19, it seems like all the "pointer" events for the chart stopped working: not able to drag, not seeing the tooltip, scatters wont grow or react to hovering. 
Also the Scatter and Line components started to gave warnings with this typescript version:

'VictoryLine' cannot be used as a JSX component.
  Its instance type '{ state: {}; getEventState: (eventKey: string | number, namespace: string, childType?: string | undefined) => any; getScopedEvents: (events: any, namespace: any, childType: any, baseProps: any) => {}; ... 43 more ...; events: unknown; }' is not a valid JSX element.
    Types of property 'componentWillReceiveProps' are incompatible.
      Type '((nextProps: Readonly<EventMixinCommonProps>, nextContext: any) => void) | undefined' is not assignable to type '((nextProps: Readonly<any>) => void) | undefined'.
        Type '(nextProps: Readonly<EventMixinCommonProps>, nextContext: any) => void' is not assignable to type '(nextProps: Readonly<any>) => void'.typescript(2786)

Steps to reproduce

Expected behavior

Tooltip would pop out near scatter hover, scatters would grow on hover, chart is draggable on x dimension.

Actual behavior

None of the expected (previously working) stuff is happening.

Environment

- Device: desktop
- OS: macOS 15
- Node: 22
@heinibee1 heinibee1 added the Type: Bug 🐛 Oh no! A bug or unintentional behavior label Feb 18, 2025
@agusvazquez
Copy link

agusvazquez commented Apr 18, 2025

After upgrading to React 19 I am facing the following crash when using VictoryZoomContainer. If I remove it it works fine.

helper-methods.js:171 Uncaught TypeError: Cannot read properties of undefined (reading 'props')
    at getTitleStyle (helper-methods.js:171:1)
    at getTitleProps (helper-methods.js:186:1)
    at getBaseProps (helper-methods.js:285:1)
    at AddEventsMixin.getBaseProps (victory-legend.js:35:24)
    at iteratee (victory-shared-events.js:113:1)
    at helpers.js:410:1
    at Array.reduce (<anonymous>)
    at traverseChildren (helpers.js:396:1)
    at Module.reduceChildren (helpers.js:420:1)
    at VictorySharedEvents.getBasePropsFromChildren (victory-shared-events.js:118:23)

@NickR49
Copy link

NickR49 commented Apr 30, 2025

After upgrading to React 19 I am facing the following crash when using VictoryZoomContainer. If I remove it it works fine.

helper-methods.js:171 Uncaught TypeError: Cannot read properties of undefined (reading 'props')
    at getTitleStyle (helper-methods.js:171:1)
    at getTitleProps (helper-methods.js:186:1)
    at getBaseProps (helper-methods.js:285:1)
    at AddEventsMixin.getBaseProps (victory-legend.js:35:24)
    at iteratee (victory-shared-events.js:113:1)
    at helpers.js:410:1
    at Array.reduce (<anonymous>)
    at traverseChildren (helpers.js:396:1)
    at Module.reduceChildren (helpers.js:420:1)
    at VictorySharedEvents.getBasePropsFromChildren (victory-shared-events.js:118:23)

I'm not using VictoryZoomContainer but I get a very similar error after upgrading to React 19 when I use VictoryLegend -

TypeError: Cannot read properties of undefined (reading 'props')
    at getTitleStyle (victory.js?v=ed826b9f:23225:41)
    at getTitleProps (victory.js?v=ed826b9f:23240:17)
    at getBaseProps9 (victory.js?v=ed826b9f:23339:22)
    at AddEventsMixin.getBaseProps (victory.js?v=ed826b9f:23417:12)
    at iteratee (victory.js?v=ed826b9f:18797:54)
    at victory.js?v=ed826b9f:3298:24
    at Array.reduce (<anonymous>)
    at traverseChildren (victory.js?v=ed826b9f:3284:23)
    at Object.reduceChildren (victory.js?v=ed826b9f:3308:10)
    at VictorySharedEvents.getBasePropsFromChildren (victory.js?v=ed826b9f:18802:40)

@heinibee1
Copy link
Author

In my case, I need both zoom and voronoi in my tooltip so im creating it like this createContainer('zoom', 'voronoi')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐛 Oh no! A bug or unintentional behavior
Projects
None yet
Development

No branches or pull requests

3 participants