I'm currently working on creating a responsive sidebar in Vue, and I encountered an issue after refactoring my project to remove the state.js file. The problem is related to the dropdown/collapse elements, and it's throwing a
TypeError: Cannot read properties of null (reading 'scrollHeight')
error that I'm struggling to resolve.
I've come across information stating that
this error occurs when the scrollHeight property is accessed on an undefined value. To fix this error, ensure that you only access the scrollHeight property on valid HTML elements.
However, I am using a template ref to reference the element, so I'm puzzled as to why it's not accessible. Moreover, this was working fine before I made the refactor, and I can't seem to find a way around this error.
If you have any suggestions or ideas, they would be greatly appreciated!
Cheers!
LangDropdown.vue (both dropdowns use the same update
event where the error occurs)
<!-- Your modified and unique code content here -->