mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-17 23:13:51 +01:00
Fix model deletion
This commit is contained in:
@@ -174,15 +174,12 @@ const BaseInput = forwardRef<EditorView, InputProps>(function InputBase(
|
||||
);
|
||||
|
||||
const isValid = useMemo(() => {
|
||||
console.log('CHECKING VALIDITY', validate);
|
||||
if (required && !validateRequire(defaultValue ?? '')) return false;
|
||||
if (typeof validate === 'boolean') return validate;
|
||||
if (typeof validate === 'function' && !validate(defaultValue ?? '')) return false;
|
||||
return true;
|
||||
}, [required, defaultValue, validate]);
|
||||
|
||||
console.log('IS VALID', isValid, defaultValue);
|
||||
|
||||
const handleChange = useCallback(
|
||||
(value: string) => {
|
||||
onChange?.(value);
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
deleteModelById,
|
||||
duplicateModelById,
|
||||
getModel,
|
||||
workspacesAtom,
|
||||
} from '@yaakapp-internal/models';
|
||||
import { duplicateModelById, getModel, workspacesAtom } from '@yaakapp-internal/models';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import React, { useMemo } from 'react';
|
||||
import { useCreateDropdownItems } from '../../hooks/useCreateDropdownItems';
|
||||
@@ -134,7 +129,9 @@ export function SidebarItemContextMenu({ child, show, close }: Props) {
|
||||
hotKeyAction: 'sidebar.delete_selected_item',
|
||||
hotKeyLabelOnly: true,
|
||||
leftSlot: <Icon icon="trash" />,
|
||||
onSelect: async () => deleteModelById(child.model, child.id),
|
||||
onSelect: async () => {
|
||||
await deleteModelWithConfirm(getModel(child.model, child.id));
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export async function deleteModelWithConfirm(model: AnyModel | null): Promise<bo
|
||||
}
|
||||
|
||||
const confirmed = await showConfirmDelete({
|
||||
id: 'delete-model-' + model.model,
|
||||
id: 'delete-model-' + model.id,
|
||||
title: 'Delete ' + modelTypeLabel(model),
|
||||
description: (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user