vue-recyclerview icon indicating copy to clipboard operation
vue-recyclerview copied to clipboard

Errors beforeDestroy component

Open hazzo opened this issue 7 years ago • 14 comments

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>

hazzo avatar Jun 04 '17 16:06 hazzo

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

hilongjw avatar Jun 05 '17 03:06 hilongjw

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>

hazzo avatar Jun 05 '17 05:06 hazzo

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

hilongjw avatar Jun 05 '17 07:06 hilongjw

I will investigate on my build. ;)

hazzo avatar Jun 05 '17 07:06 hazzo

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!

hazzo avatar Jun 06 '17 08:06 hazzo

@hazzo demo source code

hilongjw avatar Jun 06 '17 08:06 hilongjw

Thanks!

hazzo avatar Jun 06 '17 08:06 hazzo

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 avatar Jun 07 '17 07:06 hazzo

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 😕

hazzo avatar Jun 07 '17 07:06 hazzo

@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.

hilongjw avatar Jun 07 '17 08:06 hilongjw

@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 avatar Jun 07 '17 11:06 hazzo

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

hazzo avatar Jun 08 '17 05:06 hazzo

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

hilongjw avatar Jun 08 '17 05:06 hilongjw

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?

rahul-dutt-sharma avatar Oct 12 '17 05:10 rahul-dutt-sharma