ropali / dockyard

A fast & beautiful Docker GUI client
MIT License
230 stars 16 forks source link

issue: Container List component re-renders infinitely #15

Closed iammohan01 closed 1 month ago

iammohan01 commented 1 month ago

When rendering ContainersList on app start, loadContainers function has been getting called with containers as a dependency,

this is causing infinite re-render,

what i found is loadContainers calls setContainers in ContainerContext.

this is the reason for infinite re-render IG.

iammohan01 commented 1 month ago

https://github.com/user-attachments/assets/01a2b774-7737-4fd1-8d2e-ae4600b6e99b

ropali commented 1 month ago

Interesting! can you please provide steps to reproduce with your system details. I don't see this on my machine (PopOs 22.4)

iammohan01 commented 1 month ago

Machine : MacBook Pro M1 Version : 14.6.1

Docker engine: colima -> changed property in rust code since i'm not using docker desktop, so that my docker.sock it at different location.

Reproduce steps:

there is no reproduce steps, by default it renders infinity, just use console.log in that component.

How i found is : render glitch, then only i looked inside. and found this.

macOs/windows both doesn't support network mode host , -> linux docker engine uses it by default. So that i have to manually assign/forward ports in docker,

so this port forwarding gets rendering again and again.

The fix is just remove containers from dep array.

image

if you want i can make a PR for this.

ropali commented 1 month ago

@iammohan01 yeah please go ahead.

ropali commented 1 month ago

@iammohan01 one problem with that solution is if I stop/start container then it won't refresh the container list so stale data will be present until unless you force it by going to some other screen and back or reload off course.