!["fill_height" makes interface grow to infinite if "footer_links=[]" on Hugging Face.](https://www.chat-gpts.plus/wp-content/uploads/2026/07/12992-40ebb3b2.jpg)
“fill_height” makes interface grow to infinite if “footer_links=[]” on Hugging Face.
快速结论:该报错在 Gradio 6.9.0 中引入,当在 Hugging Face 上使用 footer_links=[] 且开启 fill_height 时,界面会无限纵向增长。优先确认是否在 Hugging Face Spaces 上运行,并检查是否设置了 footer_links=[]。
问题场景
用户在 Hugging Face Spaces 上运行 Gradio ChatInterface 或 Blocks 应用,使用 fill_height=True 并传入 footer_links=[] 参数时触发。该问题在本地运行时不出现,仅在 Hugging Face 的 iframe 环境中复现。
报错原文
No error logs, but check weird behaviour at: https://huggingface.co/spaces/Carbaz/infinite_space
问题表现为页面加载后界面无限制纵向增长,无明显错误日志。
原因分析
可能原因是:当 footer_links=[] 时,页脚元素完全从 DOM 中移除,导致 footer_height 始终为 0。在 Hugging Face Spaces 的 iframe 环境中,handle_resize() 函数通过 parentIFrame.size() 告诉 Hugging Face 调整 iframe 大小,但这会触发新的 resize 事件,形成反馈循环:
ResizeObserver触发 → 调用handle_resize()handle_resize()计算box.bottom + footer_height + 32并调用parentIFrame.size(new_height)- Hugging Face 调整 iframe 大小 → 再次触发 resize 事件
box.bottom增加 → 新高度更大 → 循环继续
当页脚存在时,其 clientHeight 提供一个稳定参考点,循环很快被去重检查(new_height === last_reported_height)终止;但无页脚时循环无法停止。
环境排查
- 确认 Gradio 版本是否为 6.9.0
- 确认运行环境是否为 Hugging Face Spaces(非本地直接访问)
- 检查是否在
launch()或界面定义中设置了footer_links=[] - 确认
fill_height是否已启用
解决步骤
- 临时规避:避免同时使用
footer_links=[]和fill_height,可保留默认页脚或使用footer_links=[...]提供至少一个链接元素。 - 预期修复(PR #13017):该修复在
handle_resize()函数中,当fill_height激活且无页脚时,跳过parentIFrame.size()调用,因为fill_height的语义是“填充父容器空间”,不应反向请求父容器根据内容调整大小。
验证方法
应用修复后,在 Hugging Face Spaces 上重新部署,观察页面加载后是否停止无限增长,界面应稳定填满父容器。可参考原 Issue 提供的复现空间 https://huggingface.co/spaces/Carbaz/infinite_space 验证对比。
参考来源
PR #13017 — fix: skip parentIFrame.size() when fill_height and no footer


