#Tooltip related runtime error in production build

3 messages · Page 1 of 1 (latest)

potent plaza
#

Not sure if I did something wrong, missed a dependency somewhere, or I need to change the order of my context providers, but while it seems to work just fine with a debug build, I'm getting a runtime crash in the production build when loading a component that uses Tooltip where it tries to access a context variable that is undefined (I'm currently on Mantine 5.5.5 / React 18.2.0):

TypeError: Cannot destructure property 'open' of 'context' as it is undefined.
    at $10d570edfd0c0404$export$ae780daf29e6d456 (floating-ui.react-dom-interactions.esm.js:971:5)
    at $b592912bba5282fb$export$1c4b08e0eca38426 (use-tooltip.ts:38:13)
    at Tooltip.tsx:126:29
    at $833559fe574b4225$var$Xh (react-dom.production.min.js:167:137)
    at $833559fe574b4225$var$Zi (react-dom.production.min.js:193:57)
    at $833559fe574b4225$var$Wk (react-dom.production.min.js:294:275)
    at $833559fe574b4225$var$Vk (react-dom.production.min.js:280:389)
    at $833559fe574b4225$var$Uk (react-dom.production.min.js:280:320)
    at $833559fe574b4225$var$Jk (react-dom.production.min.js:280:180)
    at $833559fe574b4225$var$Ok (react-dom.production.min.js:271:88)

Anything I can check for?
(FWIW it was doing this with 5.3.3 too)
edit: TBF it could be an issue with the floating-ui lib itself with my build stack (I'm using Parcel)

potent plaza
#

Digging into this further, it looks like it may be a Parcel scope hoisting issue with the floating-ui library (specifically useFloating?) So ultimately, it appears that Tooltip may not currently be compatible with the Parcel bundler. I'm likely going to have to rip out all of the Mantine Tooltips from my app 😢

potent plaza
#

I've confirmed this to be a problem with the way useFloating() was implemented in the floating-ui library that use-tooltip.ts imports that is unable to be processed correctly by Parcel's scope hoisting algorithm. It doesn't help my situation (without a patch hack to Mantine), but hopefully it will get addressed in the future at some point by Parcel or floating-ui.
https://github.com/floating-ui/floating-ui/discussions/1917#discussioncomment-3886586

GitHub

This may be a Mantine issue, but I'm getting a runtime error in the floating-ui lib with a production build using the Parcel bundler: TypeError: Cannot destructure property 'open&am...