feat: Add delete session in the sessions menu. (#1557)
Signed-off-by: Paolo Insogna <paolo@cowtech.it> Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
committed by
GitHub
co-authored by
Bohdan Triapitsyn
parent
a0597b1065
commit
b1810013e5
@@ -12,6 +12,11 @@ type DeleteSessionConfirmSetter = React.Dispatch<React.SetStateAction<{
|
||||
archivedBucket: boolean;
|
||||
} | null>>;
|
||||
|
||||
type DeleteSessionSource = {
|
||||
archivedBucket?: boolean;
|
||||
hardDelete?: boolean;
|
||||
};
|
||||
|
||||
type Args = {
|
||||
activeProjectId: string | null;
|
||||
currentDirectory: string | null;
|
||||
@@ -187,10 +192,10 @@ export const useSessionActions = (args: Args) => {
|
||||
const executeDeleteSession = React.useCallback(
|
||||
async (
|
||||
session: Session,
|
||||
source?: { archivedBucket?: boolean },
|
||||
source?: DeleteSessionSource,
|
||||
precomputed?: { descendantIds: string[] },
|
||||
) => {
|
||||
const shouldHardDelete = source?.archivedBucket === true;
|
||||
const shouldHardDelete = source?.archivedBucket === true || source?.hardDelete === true;
|
||||
// Use the snapshot taken when the dialog opened (if any) so the
|
||||
// executed list matches what the user was told. Fall back to a fresh
|
||||
// collection for direct-execute (no-dialog) callers.
|
||||
@@ -246,8 +251,8 @@ export const useSessionActions = (args: Args) => {
|
||||
);
|
||||
|
||||
const handleDeleteSession = React.useCallback(
|
||||
(session: Session, source?: { archivedBucket?: boolean }) => {
|
||||
const shouldHardDelete = source?.archivedBucket === true;
|
||||
(session: Session, source?: DeleteSessionSource) => {
|
||||
const shouldHardDelete = source?.archivedBucket === true || source?.hardDelete === true;
|
||||
const effectiveDescendantIds = filterDescendantsForAction(
|
||||
collectDescendants(session.id),
|
||||
shouldHardDelete,
|
||||
|
||||
Reference in New Issue
Block a user