ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

Image preview cache issue after restart

Open vmedea opened this issue 2 years ago • 3 comments

I sometimes run into strange behavior when hacking on ComfyUI and restarting it a lot:

  • ComfyUI is open in browser
  • I restart the server
  • I forget to reload the browser tab, so it reconnects to the restarted instance

The thing is—this mostly works. However, the images in "Image preview" will start to repeat from earlier run. I think it's because numbers are re-used and the browser still has the old image cached, but I don't know for sure.

In any case, it would be nice if the UI detected this and automatically reloaded, or did something else to avoid cache collisions.

Browser: Firefox Version: git 8d694cc

vmedea avatar Jul 11 '23 13:07 vmedea

PreviewImage's image stored into temp. And ComfyUI remove temp directory during startup.

ComfyUI doesn't ensure behavior of PreviewImage if restarted. It is temporary content.

If you wanna keep the image then you should use SaveImage instead of PreviewImage.

ltdrdata avatar Jul 11 '23 13:07 ltdrdata

Maybe I'm unclear, I don't want to keep the images :smile: The problem is that the browser seems to keep them cached, even though they're deleted server side, so "Image preview" shows the old image with that name instead of the new one.

This is purely visual behavior on the client side, but it can be really confusing because it won't show the newly generated image but one it generated in a previous run.

"Save Image" indeed doesn't normally suffer from the issue because it uses permanent names. Unless you delete files while ComfyUI is running, then a similar problem can happen.

vmedea avatar Jul 11 '23 13:07 vmedea