Skip to content

Commit

Permalink
it works!
Browse files Browse the repository at this point in the history
  • Loading branch information
ciur committed Sep 20, 2024
1 parent 64f9cf9 commit fa81a30
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ui2/src/features/nodes/components/DropNodesDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useAppDispatch} from "@/app/hooks"
import {useState} from "react"

import type {FolderType, NodeType} from "@/types"
Expand All @@ -12,6 +13,7 @@ import {
} from "@mantine/core"

import {useMoveNodesMutation} from "@/features/nodes/apiSlice"
import {commanderAllSelectionsCleared, dragEnded} from "@/features/ui/uiSlice"

type DropNodesModalArgs = {
sourceNodes: NodeType[]
Expand All @@ -33,6 +35,8 @@ export default function DropNodesModal({
const [errorMessage, setErrorMessage] = useState<string>("")
const movedNodesTitles = sourceNodes.map(p => p.title).join(",")
const [moveNodes, {isLoading}] = useMoveNodesMutation()
const dispatch = useAppDispatch()

const onMoveNodes = async () => {
const data = {
body: {
Expand All @@ -42,6 +46,9 @@ export default function DropNodesModal({
sourceFolderID: sourceFolderID
}
await moveNodes(data)
dispatch(dragEnded())
onSubmit()
dispatch(commanderAllSelectionsCleared())
}
const localCancel = () => {
setErrorMessage("")
Expand Down
5 changes: 5 additions & 0 deletions ui2/src/features/ui/uiSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,10 @@ const uiSlice = createSlice({

state.secondaryCommanderFilter = filter
},
commanderAllSelectionsCleared(state) {
state.mainCommanderSelectedIDs = []
state.secondaryCommanderSelectedIDs = []
},
commanderLastPageSizeUpdated(
state,
action: PayloadAction<LastPageSizeArg>
Expand Down Expand Up @@ -581,6 +585,7 @@ export const {
commanderSelectionNodeAdded,
commanderSelectionNodeRemoved,
commanderSelectionCleared,
commanderAllSelectionsCleared,
filterUpdated,
commanderLastPageSizeUpdated,
viewerThumbnailsPanelToggled,
Expand Down

0 comments on commit fa81a30

Please sign in to comment.