hilongjw / vue-recyclerview

Mastering Large Lists with the vue-recyclerview
https://hilongjw.github.io/vue-recyclerview/
MIT License
1.45k stars 121 forks source link

Errors beforeDestroy component #10

Open hazzo opened 7 years ago

hazzo commented 7 years ago

Testing the component I get errors when I go to another route before destroying the component.

Example:

Error in beforeDestroy hook: "TypeError: Cannot read property 'height' of undefined"

found in

---> <RecyclerView>
       <Thread> at C:\wamp64\www\vue_mobile_material\src\components\thread\Thread.vue
         <QLayout>
           <Layout> at C:\wamp64\www\vue_mobile_material\src\components\Layout.vue
             <App> at C:\wamp64\www\vue_mobile_material\src\App.vue
               <Root>
hilongjw commented 7 years ago

@hazzo The problem here should have been fixed in 0.3.2, can you test it in 0.3.3?

hazzo commented 7 years ago

Sorry I keep getting this error 😟

vue.runtime.esm.js?a427:430 [Vue warn]: Error in beforeDestroy hook: "TypeError: Cannot read property 'height' of undefined"

found in

---> <RecyclerView>
hilongjw commented 7 years ago

Can you describe the details of the scene? I tried switching RecyclerView and other views without experiencing problem.

hazzo commented 7 years ago

I will investigate on my build. ;)

hazzo commented 7 years ago

Hi again @hilongjw sorry could you upload your demo without compressing it? I need to reproduce the same effect in your demo that when you scroll up yo load more data. Now I'm loading everything at once at is not ideal 😟

Thanks!

hilongjw commented 7 years ago

@hazzo demo source code

hazzo commented 7 years ago

Thanks!

hazzo commented 7 years ago

The error beforeDestroy is solved. But before destroying the component execute the fetch action. That's not a good practice no? What is the need of it?

hazzo commented 7 years ago

Another thing in your demo on the chat section, it'seems that when you scroll up it loads more elements. But if I replicate your demo with my data it loads all the data an scrolls to index. How did you achieve the effect that when scrolling up the scroll bar increases?

Sorry for to many requests 😕

hilongjw commented 7 years ago

@hazzo because my demo is using the local mock data, the problem is that all data will be loaded when scrolling to the end, and I'll fix it.

hazzo commented 7 years ago

@hilongjw yes I am using "local data" too, I mean i get all the data before store it in vuex and in each chat I display the data. Bue it would be perfect that when you scroll to bottom avoid loading all data, only just when scroll up.

hazzo commented 7 years ago

Hi @hilongjw did you have a chance look why fetch action is executed when destroying the component?

hilongjw commented 7 years ago

@hazzo got it thank you, I'll check it later.

rahul-dutt-sharma commented 6 years ago

any fix on not calling the fetch function before destroy

But before destroying the component execute the fetch action. That's not a good practice no? What is the need of it?