Sitronik / vue3-beautiful-chat

A simple and beautiful Vue 3 chat component backend agnostic, fully customisable and extendable.
MIT License
95 stars 27 forks source link

Cannot read properties of null (reading 'scrollHeight') #4

Closed utking closed 2 years ago

utking commented 2 years ago

A simple scenario - a simple app with two routes - one with the chat and another without it. When you leave the page with the chat component, it throws an error

Uncaught TypeError: Cannot read properties of null (reading 'scrollHeight')
    at ResizeObserver.eval (vue3-beautiful-chat.umd.js:10:10950)

The ResizeObserver in https://github.com/Sitronik/vue3-beautiful-chat/blob/master/src/MessageList.vue#L132 is still there, while the $refs.scrollList is not. Looks like ResizeObserver.disconnect() on unmount should solve the problem.

github-actions[bot] commented 2 years ago

Thanks for opening up your first issue!

Sitronik commented 2 years ago

@utking Thanks for the issue, you can do PR 😉

utking commented 2 years ago

@utking Thanks for the issue, you can do PR wink

Sure, will do :)

utking commented 2 years ago

Please see https://github.com/Sitronik/vue3-beautiful-chat/pull/5 for a possible solution

Sitronik commented 2 years ago

Please see #5 for a possible solution

Thanks 👍