vue-grid-layout icon indicating copy to clipboard operation
vue-grid-layout copied to clipboard

Components render repeatedly when window size is changed

Open huochangying opened this issue 2 years ago • 5 comments

Software version (please complete the following information):

  • Browser [e.g. chrome, safari]
  • Vue Version [^3.2.39]
  • vue-grid-layout Version: [^3.0.0-beta1]

Describe the bug Components render repeatedly when window size is changed,api interfaces in components to be called multiple times

To Reproduce 1.F12 2.change the window size

Expected behavior Components do not re render when changing the window size

Screenshots image image

Additional context Add any other context about the problem here.

huochangying avatar Dec 28 '22 03:12 huochangying

I'm not sure this is related to vue-grid-layout. It looks to me whenever the viewport is resized, the dynamic component executes loadComponent(). While I saw loadComponent() triggered multiple times as I dragged the window size around, I could not trigger any lifecycle hooks on the component.

Is it possible your issue is unrelated to vue-grid-component and instead due to <component :is> itself constantly calling your function?

jvjvjv avatar Dec 28 '22 16:12 jvjvjv

I'm not sure this is related to vue-grid-layout. It looks to me whenever the viewport is resized, the dynamic component executes loadComponent(). While I saw loadComponent() triggered multiple times as I dragged the window size around, I could not trigger any lifecycle hooks on the component.

Is it possible your issue is unrelated to vue-grid-component and instead due to <component :is> itself constantly calling your function?

Thank you for reminding me. I did a test, but the problem still exists..... image image image

huochangying avatar Dec 29 '22 02:12 huochangying

Can you send me a codepen or something where this issue occurs?

jvjvjv avatar Dec 31 '22 12:12 jvjvjv

Can you send me a codepen or something where this issue occurs?

https://codesandbox.io/embed/unruffled-architecture-onn9sr

huochangying avatar Jan 03 '23 07:01 huochangying

OK. I can actually see it. The components are definitely not re-rendering, but every time a resize event gets triggered. I'll see if I can figure something out.

jvjvjv avatar Jan 03 '23 16:01 jvjvjv