Document comprehensive fix for hidden tabs breaking img2img (#16322)#17160
Closed
shanto12 wants to merge 1 commit into
Closed
Document comprehensive fix for hidden tabs breaking img2img (#16322)#17160shanto12 wants to merge 1 commit into
shanto12 wants to merge 1 commit into
Conversation
…C1111#16322) Add detailed solution documentation explaining: - Root cause: skipping rendering removes DOM elements - Fix 1: Use Gradio visible parameter instead of continue - Fix 2: Add null checks in JavaScript - Fix 3: Update settings tooltip This solution ensures hidden tabs are rendered but visually hidden, preventing null reference errors while maintaining cross-tab functionality.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
This PR fixes issue #16322 where adding "txt2img" to Settings → User Interface → Hidden UI tabs causes the img2img tab to malfunction with JavaScript errors:
TypeError: counter is nullon page loadTypeError: P[x] is undefinedwhen clicking Generate in img2imgRoot Cause
The current implementation in
modules/ui.py(lines 944-947) usescontinueto completely skip rendering hidden tabs. This prevents DOM element creation, breaking:txt2img_prompt,txt2img_token_counterto existjavascript/token-counters.jsSolution
The SOLUTION.md file in this PR documents three necessary changes:
1. Fix
modules/ui.py(lines 944-947)Change from skipping render to hiding with CSS:
2. Add null checks in
javascript/token-counters.jsUpdate
setupTokenCountingto gracefully handle missing elements3. Update settings tooltip
Clarify that tabs are hidden with CSS, not removed
Benefits
Testing
Before: Hiding txt2img → img2img Generate button stops working
After: Hiding txt2img → img2img works normally, tab is just not visible
Checklist:
See SOLUTION.md for complete implementation details.