Upload folder using huggingface_hub
Browse files
6.11.0/gallery/shared/Gallery.svelte
CHANGED
|
@@ -229,15 +229,13 @@
|
|
| 229 |
}
|
| 230 |
|
| 231 |
$effect(() => {
|
|
|
|
| 232 |
if (selected_index !== old_selected_index) {
|
| 233 |
old_selected_index = selected_index;
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
Math.min(selected_index, resolved_value.length - 1)
|
| 239 |
-
);
|
| 240 |
-
}
|
| 241 |
onselect({
|
| 242 |
index: selected_index,
|
| 243 |
value: resolved_value?.[selected_index]
|
|
|
|
| 229 |
}
|
| 230 |
|
| 231 |
$effect(() => {
|
| 232 |
+
// Only trigger the effect if the selected_index has actually changed
|
| 233 |
if (selected_index !== old_selected_index) {
|
| 234 |
old_selected_index = selected_index;
|
| 235 |
+
|
| 236 |
+
// Ensure we have a valid selection and data to work with
|
| 237 |
+
if (selected_index !== null && resolved_value !== null) {
|
| 238 |
+
// Notify the parent component or listener about the updated selection
|
|
|
|
|
|
|
|
|
|
| 239 |
onselect({
|
| 240 |
index: selected_index,
|
| 241 |
value: resolved_value?.[selected_index]
|