fix: actions in a model's menu in the model selector do nothing (#31503)

Picking Edit, Keep in Sidebar, Copy Link or Delete from the menu next to a model in the model selector did nothing: the selector closed and the action never ran. These actions work again. Edit and Delete now also close the selector, so the first click in the settings window or the delete confirmation that opens is not lost.
This commit is contained in:
Classic298 2026-09-28 04:16:07 +02:00 • committed by GitHub
parent c8a3e10e13
commit 8667dd7121
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 0 deletions

View file

@ -33,6 +33,7 @@
export let selectionOnly = false;
export let onClick: () => void = () => {};
export let onEdit: () => void = () => {};
$: localizedDescription = resolveLocalizedModelDescription(item.model, $i18n.language);
@ -304,6 +305,7 @@
model={item.model}
{pinModelHandler}
{deleteModelHandler}
{onEdit}
copyLinkHandler={() => {
copyLinkHandler(item.model);
}}

View file

@ -20,6 +20,7 @@
export let pinModelHandler: (modelId: string) => void = () => {};
export let copyLinkHandler: Function = () => {};
export let deleteModelHandler: Function = () => {};
export let onEdit: () => void = () => {};
export let onClose: Function = () => {};
@ -30,6 +31,7 @@
bind:show
align="end"
sideOffset={-2}
contentClass="model-selector-child-menu"
onOpenChange={(state) => {
if (state === false) {
onClose();
@ -61,6 +63,7 @@
showSettings.set({ tab: 'admin:models', state: { id: model?.id ?? null } });
}
show = false;
onEdit();
}}
>
<Pencil className="size-3.5" />

View file

@ -810,6 +810,7 @@
let deleteModelTarget: any = null;
const deleteModelHandler = async (model: any) => {
show = false;
deleteModelTarget = model;
showDeleteConfirm = true;
};
@ -1108,6 +1109,9 @@
onClick={() => {
selectItem(item, index);
}}
onEdit={() => {
show = false;
}}
/>
{/each}
<div style="height: {(filteredItems.length - visibleEnd) * ITEM_HEIGHT}px;" />