Skip to content

ImageEditor breaks the page when hidden then revealed. #12021

@dom-nura

Description

@dom-nura

Describe the bug

if you hide then unhide the column in which you have an image editor, the image editor breaks the page, rendering it unresponsive, also its internal content gets cleared.

error in console:

resize.ts:1708 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'background_image')
    at xy.hide_resize_ui (resize.ts:1708:33)
    at xy.set_tool (resize.ts:294:9)
    at So.set_tool (editor.ts:648:9)
    at oe (ImageEditor.svelte:450:10)
    at s.$$.update (ImageEditor.svelte:673:3)
    at oe (svelte.js:1:15679)
    at ee (svelte.js:1:15394)

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr
 with gr.Column(scale=12, visible=True) as col:
            foobar = gr.ImageEditor(
                label="foobar",
                type="numpy",
                transforms=None,
                height=728,
                scale=12,
                visible=True
            )
hide_button.click(
        fn=hide_this,
        outputs=[col])
show_button.click(
        fn=show_this,
        outputs=[col])

Screenshot

No response

Logs

System Info

gradio 5.48.0
Chrome, Windows 11. Also reproduced on Chrome MacOS

Severity

Blocking usage of gradio

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions