Skip to content

fix: Gallery control cannot be deleted individually#13217

Closed
majiayu000 wants to merge 2 commits intogradio-app:mainfrom
majiayu000:fix/issue-13207-gallery-individual-delete
Closed

fix: Gallery control cannot be deleted individually#13217
majiayu000 wants to merge 2 commits intogradio-app:mainfrom
majiayu000:fix/issue-13207-gallery-individual-delete

Conversation

@majiayu000
Copy link
Copy Markdown
Contributor

Description

After the Svelte 4 to 5 migration, deleting individual gallery items fails silently. handle_delete in Index.svelte still expects a CustomEvent and reads event.detail, but Gallery.svelte now calls the ondelete prop callback with the data object directly. Changed the parameter from event: CustomEvent to the data object itself.

Closes: #13207

AI Disclosure

  • I used AI to help write the test case
  • I did not use AI

Testing and Formatting Your Code

Added a test in js/gallery/Gallery.test.ts that renders an interactive gallery, clicks the delete button, and verifies the item is removed.

…vent

Gallery.svelte calls ondelete(data) as a prop callback, passing
{file, index} directly. Index.svelte's handle_delete was still
expecting a CustomEvent and accessing event.detail, which broke
individual item deletion.

Signed-off-by: majiayu000 <1835304752@qq.com>
Verify that clicking the delete button on an interactive gallery item
dispatches the delete event with correct index and triggers a change event.
This covers the handle_delete fix that changed the parameter from
CustomEvent to a direct data object.

Signed-off-by: majiayu000 <1835304752@qq.com>
@majiayu000 majiayu000 marked this pull request as ready for review April 8, 2026 07:46
@freddyaboulton
Copy link
Copy Markdown
Collaborator

Hi @majiayu000 ! Thanks for the pr. This is fixed in #13213 so I will close this in favor of that one.

@freddyaboulton freddyaboulton mentioned this pull request Apr 8, 2026
2 tasks
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.

The Gallery control cannot be deleted individually

2 participants