File tree Expand file tree Collapse file tree 3 files changed +15
-16
lines changed
src/frontend/apps/impress/src/features/docs
doc-management/components Expand file tree Collapse file tree 3 files changed +15
-16
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ and this project adheres to
23
23
### Fixed
24
24
25
25
- 🐛(service-worker) Fix useOffline Maximum update depth exceeded #1196
26
+ - 🐛(frontend) fix empty left panel after deleting root doc #1197
26
27
- 🐛(helm) charts generate invalid YAML for collaboration API / WS #890
27
28
- 🐛(frontend) 401 redirection overridden #1214
28
29
Original file line number Diff line number Diff line change @@ -15,15 +15,15 @@ import { useRemoveDoc } from '../api/useRemoveDoc';
15
15
import { Doc } from '../types' ;
16
16
17
17
interface ModalRemoveDocProps {
18
- onClose : ( ) => void ;
19
18
doc : Doc ;
20
- afterDelete ?: ( doc : Doc ) => void ;
19
+ onClose : ( ) => void ;
20
+ onSuccess ?: ( doc : Doc ) => void ;
21
21
}
22
22
23
23
export const ModalRemoveDoc = ( {
24
- onClose,
25
24
doc,
26
- afterDelete,
25
+ onClose,
26
+ onSuccess,
27
27
} : ModalRemoveDocProps ) => {
28
28
const { toast } = useToastProvider ( ) ;
29
29
const { t } = useTranslation ( ) ;
@@ -35,19 +35,17 @@ export const ModalRemoveDoc = ({
35
35
error,
36
36
} = useRemoveDoc ( {
37
37
onSuccess : ( ) => {
38
- toast ( t ( 'The document has been deleted.' ) , VariantType . SUCCESS , {
39
- duration : 4000 ,
40
- } ) ;
41
- if ( afterDelete ) {
42
- afterDelete ( doc ) ;
43
- return ;
44
- }
45
-
46
- if ( pathname === '/' ) {
38
+ if ( onSuccess ) {
39
+ onSuccess ( doc ) ;
40
+ } else if ( pathname === '/' ) {
47
41
onClose ( ) ;
48
42
} else {
49
43
void push ( '/' ) ;
50
44
}
45
+
46
+ toast ( t ( 'The document has been deleted.' ) , VariantType . SUCCESS , {
47
+ duration : 4000 ,
48
+ } ) ;
51
49
} ,
52
50
} ) ;
53
51
Original file line number Diff line number Diff line change @@ -125,15 +125,15 @@ export const DocTreeItemActions = ({
125
125
} ,
126
126
} ) ;
127
127
128
- const afterDelete = ( ) => {
128
+ const onSuccessDelete = ( ) => {
129
129
if ( parentId ) {
130
130
void router . push ( `/docs/${ parentId } ` ) . then ( ( ) => {
131
131
setTimeout ( ( ) => {
132
132
treeContext ?. treeData . deleteNode ( doc . id ) ;
133
133
} , 100 ) ;
134
134
} ) ;
135
135
} else if ( doc . id === treeContext ?. root ?. id && ! parentId ) {
136
- void router . push ( `/docs/ ` ) ;
136
+ void router . push ( `/` ) ;
137
137
} else if ( treeContext && treeContext . root ) {
138
138
void router . push ( `/docs/${ treeContext . root . id } ` ) . then ( ( ) => {
139
139
setTimeout ( ( ) => {
@@ -193,7 +193,7 @@ export const DocTreeItemActions = ({
193
193
< ModalRemoveDoc
194
194
onClose = { deleteModal . onClose }
195
195
doc = { doc }
196
- afterDelete = { afterDelete }
196
+ onSuccess = { onSuccessDelete }
197
197
/>
198
198
) }
199
199
</ Box >
You can’t perform that action at this time.
0 commit comments