mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-25 19:56:13 +01:00
🔀 fix: Rerender Edge Cases After Migration to Shared Package (#8713)
* fix: render issues in PromptForm by decoupling nested dependencies as a result of @librechat/client components * fix: MemoryViewer flicker by moving EditMemoryButton and DeleteMemoryButton outside of rendering * fix: CategorySelector to use DropdownPopup for improved mobile compatibility * chore: imports
This commit is contained in:
parent
8e6eef04ab
commit
a4ca4b7d9d
4 changed files with 401 additions and 268 deletions
|
|
@ -1,8 +1,10 @@
|
|||
import React, { useCallback } from 'react';
|
||||
import { Trash2 } from 'lucide-react';
|
||||
import { useDeletePrompt } from '~/data-provider';
|
||||
import { Button, OGDialog, OGDialogTrigger, Label, OGDialogTemplate } from '@librechat/client';
|
||||
import { useLocalize } from '~/hooks';
|
||||
|
||||
const DeleteVersion = ({
|
||||
const DeleteConfirmDialog = ({
|
||||
name,
|
||||
disabled,
|
||||
selectHandler,
|
||||
|
|
@ -58,4 +60,42 @@ const DeleteVersion = ({
|
|||
);
|
||||
};
|
||||
|
||||
export default DeleteVersion;
|
||||
interface DeletePromptProps {
|
||||
promptId?: string;
|
||||
groupId: string;
|
||||
promptName: string;
|
||||
disabled: boolean;
|
||||
}
|
||||
|
||||
const DeletePrompt = React.memo(
|
||||
({ promptId, groupId, promptName, disabled }: DeletePromptProps) => {
|
||||
const deletePromptMutation = useDeletePrompt();
|
||||
|
||||
const handleDelete = useCallback(() => {
|
||||
if (!promptId) {
|
||||
console.warn('No prompt ID provided for deletion');
|
||||
return;
|
||||
}
|
||||
deletePromptMutation.mutate({
|
||||
_id: promptId,
|
||||
groupId,
|
||||
});
|
||||
}, [promptId, groupId, deletePromptMutation]);
|
||||
|
||||
if (!promptId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<DeleteConfirmDialog
|
||||
name={promptName}
|
||||
disabled={disabled || !promptId}
|
||||
selectHandler={handleDelete}
|
||||
/>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
DeletePrompt.displayName = 'DeletePrompt';
|
||||
|
||||
export default DeletePrompt;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue