Skip to content

Conversation

@duckcomfy
Copy link

@duckcomfy duckcomfy commented May 20, 2025

closes #364

Bug/Reproduction

  • Have ComfyUI-VideoHelperSuite installed with video previews enabled in user settings
  • Run a generation, switch to another workflow, then come back
  • The generation preview no longer appears, until the next generation

Please note that having animated previews enabled breaks even non-animated previews.

Identified cause

  • The handler for the VHS_latentpreview event, which is run once per generation, detects the currently executing node. Since VHS_latentpreview is emitted by the get_previewer in the latent_preview Python module, this executing node will always be some sort of sampler.
  • It then calls node#addDOMWidget to add to the node the widget that shows previews capable of displaying videos
  • However, this method of adding a node widget doesn't survive workflow switching (I assume custom nodes typically use node#addDOMWidget in some location that is run even on workflow switch, but since this way of adding video-capabilities to previews is node-agnostic, we are using it inside this event where it won't work on workflow switch)

Fix

I changed animateInterval, which updates the displayed image, such that before updating the image, we check whether the currently executing node still has its widget; if not, we re-add the widget first.

For users: How to get this fix

If this PR has been merged, or the author has closed it and implemented their own fix, ensure you are using the latest nightly version of the node pack.

If this PR has not been merged, navigate in the command line to ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite/ (or comfyui-videohelpersuite, check which one applies for you), then run:

git remote add duckcomfy https://github.com/duckcomfy/ComfyUI-VideoHelperSuite.git
git fetch duckcomfy
git merge duckcomfy/main

If you experience issues in the future because the official fix is incompatible with mine, reinstall the nodepack.

closes Kosinkadink#364

[Bug/Reproduction]

- Have ComfyUI-VideoHelperSuite installed with video previews enabled in user settings
- Run a generation (**it doesn't need to be video**), switch to another workflow, then come back
- Generation preview no longer appears until the next generation

[Identified cause]

- The handler for the `VHS_latentpreview` event, which is run once per generation, detects the currently executing node. Since `VHS_latentpreview` is emitted by the `get_previewer` in the latent_preview Python module, this executing node will always be some sort of sampler.
- It then calls `node#addDOMWidget` to add to the node the widget that shows previews capable of displaying videos
- However, this method of adding a node widget doesn't survive workflow switching (I assume custom nodes typically use `node#addDOMWidget` in some location that is run even on workflow switch, but since this way of adding video-capabilities to previews is node-agnostic, we are using it inside this event where it won't work on workflow switch)

[Fix]

I changed `animateInterval`, which updates the displayed image, such that before updating the image, we check whether the currently executing node still has its widget; if not, we re-add the widget first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Latent Video Preview disappears if you switch workflows during the generation

1 participant