Error only in build (TypeError: Cannot read property 'insertBefore' of null) with v-if and data property updates
Version
3.1.4
Reproduction link
https://github.com/mschoeffel/vite-build-error
Steps to reproduce
- Pull Github Repo
- Start with either
npm run serve
to see how it should work. Or deploy thedist
directory afternpm run build
to any webserver like nginx to get the errors. - Open in browser
localhost:3000
or the URL of the webserver or my deployed link.(see aditional info) - Log in via Username:
John.Doe@mail.com
- Password:test123
- Navigate to
/apartments
or with the navigation bar on the left sideWohnungen
. - Error 1: Select an apartment from the list and click on it again to deselect it. -> Now no apartment can be selected anymore and the error appears in the console. Reload is required to get it working again. (Switching from one apartment to the other works fine. The error only occurrs if deselecting the currently selected apartment)
- Error 2: If inputting something into the search input at the top of the same page the apartments get filtered accordingly(eg. enter Rund) if then removing the searchinput all apartments appear again. But if you select one apartment of the filtered list and the remove the searchinput you get errors and the list doesn't get updated.
What is expected?
The GUI is updated accordingly. Error 1: Apartment Details is shown/hidden. Error 2: The apartmentlist is updated.
What is actually happening?
GUI freezes and Error "TypeError: Cannot read property 'insertBefore' of null" is logged.
In dev everything works fine as expected and no errors or warnings are logged.
- Link to Stackoverflow with even more info: https://stackoverflow.com/questions/68409164/vite-error-only-in-build-typeerror-cannot-read-property-insertbefore-of-null
- Link to the deployed application to see error: https://votox.mschoeffel.de/
- Link to Vue file where the errors are comming from: https://github.com/mschoeffel/vite-build-error/blob/main/src/views/Apartments.vue
Your repro is far from minimal. Please open a new issue if you manage to reproduce it down with only Vue (no ui libs, no router, not ta, no tests, etc) and with a boiled down component. Usually this should kind of error should be reproducible with the SFC playground.
You can always use the chat to ask questions