Skip to content

Commit 3edebcd

Browse files
committed
Redirect to note after creating
1 parent b69c4dc commit 3edebcd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/lib/v2/hooks/local/useLocalUI.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
getFolderPathname,
99
getNoteTitle,
1010
getParentFolderPathname,
11+
getDocHref,
1112
} from '../../../db/utils'
1213
import { join } from 'path'
1314
import BasicInputFormLocal from '../../../../components/v2/organisms/BasicInputFormLocal'
@@ -267,13 +268,18 @@ export function useLocalUI() {
267268
return
268269
}
269270

270-
await createNote(body.workspaceId, {
271+
const note = await createNote(body.workspaceId, {
271272
title: inputValue,
272273
folderPathname:
273274
body.parentFolderPathname != null
274275
? body.parentFolderPathname
275276
: '/',
276277
})
278+
279+
if (note != null) {
280+
push(getDocHref(note, body.workspaceId))
281+
}
282+
277283
closeModalAndUpdateState()
278284
}}
279285
/>,
@@ -283,7 +289,7 @@ export function useLocalUI() {
283289
}
284290
)
285291
},
286-
[openModal, createNote, closeModalAndUpdateState]
292+
[openModal, createNote, push, closeModalAndUpdateState]
287293
)
288294

289295
const removeWorkspace = useCallback(

0 commit comments

Comments
 (0)