fix: Gallery control cannot be deleted individually#13217
Closed
majiayu000 wants to merge 2 commits intogradio-app:mainfrom
Closed
fix: Gallery control cannot be deleted individually#13217majiayu000 wants to merge 2 commits intogradio-app:mainfrom
majiayu000 wants to merge 2 commits intogradio-app:mainfrom
Conversation
…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>
Collaborator
|
Hi @majiayu000 ! Thanks for the pr. This is fixed in #13213 so I will close this in favor of that one. |
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.
Description
After the Svelte 4 to 5 migration, deleting individual gallery items fails silently.
handle_deleteinIndex.sveltestill expects aCustomEventand readsevent.detail, butGallery.sveltenow calls theondeleteprop callback with the data object directly. Changed the parameter fromevent: CustomEventto the data object itself.Closes: #13207
AI Disclosure
Testing and Formatting Your Code
Added a test in
js/gallery/Gallery.test.tsthat renders an interactive gallery, clicks the delete button, and verifies the item is removed.