guillaumeparis2000 / react-piwik

Library that allow to connect piwik with the react-router and track custom events
31 stars 17 forks source link

`Cannot read properties of undefined (reading 'parentNode')` #45

Open tordans opened 2 years ago

tordans commented 2 years ago

I think this issue is the same as described and analyzed in https://github.com/joernroeder/piwik-react-router/issues/48 and solved in https://github.com/joernroeder/piwik-react-router/pull/54/files (over there) and https://github.com/guillaumeparis2000/react-piwik/pull/24 (here).

We are working around the issue ATM by catching the error.

Example test failure:

  FAIL  src/apps/Analysis/components/Lorem.unit.test.tsx
  ● Test suite failed to run

    TypeError: Cannot read properties of undefined (reading 'parentNode')

      14 | let history: ReturnType<typeof createBrowserHistory>;
      15 | try {
    > 16 |   const piwik = new ReactPiwik({
         |                 ^
      17 |     url: config.piwik.url,
      18 |     …

      at t.value (node_modules/react-piwik/lib/React-Piwik.js:1:2360)
      at new t (node_modules/react-piwik/lib/React-Piwik.js:1:1690)
      at Object.<anonymous> (src/history.ts:16:17)
      at Object.<anonymous> (src/pages/User/UserState.js:4:1)
      …
      at Object.<anonymous> (src/store.ts:7:1)
      at Object.<anonymous> (src/utils/test-utils.tsx:10:1)
      at Object.<anonymous> (src/apps/Analysis/components/Lorem.unit.test.tsx:4:1)