Comfy-Org / Comfy-Org/ComfyUI_frontend

Widget control mode 'control before generate' doesn't change on first run after tab switch

Open
#6,411 1 comment 0 reactions 0 assignees View on GitHub
area:ui area:widgets Potential Bug
Dominant language
TypeScript
Stars
2k
Forks
702
Avg merge
1d 8h
Merged PRs (30d)
512

Description

### Custom Node Testing

- [x] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)

### Expected Behavior

The 'control before generate' function set to 'randomise' should execute on the first click of 'Run' after the tab changes, just as it does when the tab has been active continuously

### Actual Behavior

The first click on "Run" after re-focusing the tab is ignored. The seed changes only executes on the second click.

![Image](https://github.com/user-attachments/assets/3fed3204-fdd0-4d66-9ca1-78fd2eeb1652)

I tested without extensions and had the same result.

### Steps to Reproduce

1. Have a node that has a 'control after generate' input type
2. Open the settings menu
3. Change Widget control mode from the "after" to "before"
4. Switch ComfyUI tab to another and then go back
5. Run the workflow

### Debug Logs

```powershell
Checkpoint files will always be loaded safely.
Total VRAM 6144 MB, total RAM 16295 MB
pytorch version: 2.9.0.dev20250716+cu129
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 2060 : cudaMallocAsync
Using pytorch attention
Python version: 3.12.10 (tags/v3.12.10:0cc8128, Apr 8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)]
ComfyUI version: 0.3.49
ComfyUI frontend version: 1.23.4
[Prompt Server] web root: D:\Program Files\ComfyUI\venv\Lib\site-packages\comfyui_frontend_package\static
Skipping loading of custom nodes
Context impl SQLiteImpl.
Will assume non-transactional DDL.
No target revision found.
Starting server

To see the GUI go to: http://127.0.0.1:8188
got prompt
model weight dtype torch.float16, manual cast: None
model_type V_PREDICTION
got prompt
Using pytorch attention in VAE
Using pytorch attention in VAE
VAE load device: cuda:0, offload device: cpu, dtype: torch.float32
Requested to load SDXLClipModel
loaded completely 9.5367431640625e+25 1560.802734375 True
CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cuda:0, dtype: torch.float16
Requested to load SDXL
loaded partially 3642.6749923706057 3642.6745681762695 0
100%|████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:05<00:00, 5.74s/it]
Requested to load AutoencoderKL
loaded completely 469.97443847656245 319.11416244506836 True
Prompt executed in 39.43 seconds
Prompt executed in 0.01 seconds
```

### Other

_No response_

---

*This issue is transferred from: https://github.com/comfyanonymous/ComfyUI/issues/9251*

Original issue was created by @younyokel at 2025-08-08T15:37:56.000Z

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-6411-Widget-control-mode-control-before-generate-doesn-t-change-on-first-run-after-tab-sw-29c6d73d365081b19d93f9fa4f0170b3) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Research direction

No source files or tests are named. Start from the frontend settings path for Widget control mode and the Run action's handling after tab focus returns; reproduce the first-run behavior with a widget using control before generate. Done means the first Run after switching back applies the control and a regression test covers that sequence.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.