Skip to content

Fix infinite effect loop in tabs#13240

Draft
freddyaboulton wants to merge 7 commits intomainfrom
13198-fix-tab-switch
Draft

Fix infinite effect loop in tabs#13240
freddyaboulton wants to merge 7 commits intomainfrom
13198-fix-tab-switch

Conversation

@freddyaboulton
Copy link
Copy Markdown
Collaborator

@freddyaboulton freddyaboulton commented Apr 9, 2026

Description

Closes: #13198

  • In Fix Tab Interactive Bug #13048, I added _sync_tab helper that ran via svelte 4 $:. However, with apps with large components in hidden tabs (plot, dataframe) this was causing infinite loops. Fixed this by deferring the tabs mutation via tick() so it runs outside the effect reactive context.
  • In investigating the tabs issue, I noticed that the dataframe component to cause a similar but different stack overflow exception. Claude tracked this down to how table.setOptions works. Each call wrapped the previous options in a mergeObjects layer. Properties like groupedColumnMode that only exist in the deepest default layer had to traverse every layer on access, eventually overflowing the stack.

AI Disclosure

We encourage the use of AI tooling in creating PRs, but the any non-trivial use of AI needs be disclosed. E.g. if you used Claude to write a first draft, you should mention that. Trivial tab-completion doesn't need to be disclosed. You should self-review all PRs, especially if they were generated with AI.

  • I used AI to... [fill here]
  • I did not use AI

🎯 PRs Should Target Issues

Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.

Not adhering to this guideline will result in the PR being closed.

Testing and Formatting Your Code

  1. PRs will only be merged if tests pass on CI. We recommend at least running the backend tests locally, please set up your Gradio environment locally and run the backed tests: bash scripts/run_backend_tests.sh

  2. Please run these bash scripts to automatically format your code: bash scripts/format_backend.sh, and (if you made any changes to non-Python files) bash scripts/format_frontend.sh

@gradio-pr-bot
Copy link
Copy Markdown
Collaborator

gradio-pr-bot commented Apr 9, 2026

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Storybook ready! Storybook preview
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://huggingface.co/buckets/gradio/pypi-previews/resolve/af5f2e58c1938b21adc70aaa5bbd8b1ea0d1b38d/gradio-6.12.0-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@af5f2e58c1938b21adc70aaa5bbd8b1ea0d1b38d#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/af5f2e58c1938b21adc70aaa5bbd8b1ea0d1b38d/gradio-client-2.2.0.tgz

@gradio-pr-bot
Copy link
Copy Markdown
Collaborator

gradio-pr-bot commented Apr 9, 2026

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/dataframe patch
@gradio/tabs patch
gradio patch

  • Fix infinite effect loop in tabs

✅ Changeset approved by @freddyaboulton

  • Maintainers can remove approval by unchecking this checkbox.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@freddyaboulton freddyaboulton changed the title Fix stack overflow when hidden tab has dataframe Fix infinite effect loop in tabs Apr 14, 2026
@freddyaboulton freddyaboulton marked this pull request as ready for review April 14, 2026 17:37
@freddyaboulton freddyaboulton marked this pull request as draft April 14, 2026 19:52
@pngwn
Copy link
Copy Markdown
Member

pngwn commented Apr 20, 2026

I didnt see either of these issues when i was building demos with tabs and dataframes (many tabs, many dataframes). Do we have a reliable repro?

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.

With Gradio 6.11.0 tab switching completey freezes compared to 6.10.0

3 participants