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
2323### Fixed
2424
2525- 🐛(service-worker) Fix useOffline Maximum update depth exceeded #1196
26+ - 🐛(frontend) fix empty left panel after deleting root doc #1197
2627- 🐛(helm) charts generate invalid YAML for collaboration API / WS #890
2728- 🐛(frontend) 401 redirection overridden #1214
2829
Original file line number Diff line number Diff line change @@ -15,15 +15,15 @@ import { useRemoveDoc } from '../api/useRemoveDoc';
1515import { Doc } from '../types' ;
1616
1717interface ModalRemoveDocProps {
18- onClose : ( ) => void ;
1918 doc : Doc ;
20- afterDelete ?: ( doc : Doc ) => void ;
19+ onClose : ( ) => void ;
20+ onSuccess ?: ( doc : Doc ) => void ;
2121}
2222
2323export const ModalRemoveDoc = ( {
24- onClose,
2524 doc,
26- afterDelete,
25+ onClose,
26+ onSuccess,
2727} : ModalRemoveDocProps ) => {
2828 const { toast } = useToastProvider ( ) ;
2929 const { t } = useTranslation ( ) ;
@@ -35,19 +35,17 @@ export const ModalRemoveDoc = ({
3535 error,
3636 } = useRemoveDoc ( {
3737 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 === '/' ) {
4741 onClose ( ) ;
4842 } else {
4943 void push ( '/' ) ;
5044 }
45+
46+ toast ( t ( 'The document has been deleted.' ) , VariantType . SUCCESS , {
47+ duration : 4000 ,
48+ } ) ;
5149 } ,
5250 } ) ;
5351
Original file line number Diff line number Diff line change @@ -125,15 +125,15 @@ export const DocTreeItemActions = ({
125125 } ,
126126 } ) ;
127127
128- const afterDelete = ( ) => {
128+ const onSuccessDelete = ( ) => {
129129 if ( parentId ) {
130130 void router . push ( `/docs/${ parentId } ` ) . then ( ( ) => {
131131 setTimeout ( ( ) => {
132132 treeContext ?. treeData . deleteNode ( doc . id ) ;
133133 } , 100 ) ;
134134 } ) ;
135135 } else if ( doc . id === treeContext ?. root ?. id && ! parentId ) {
136- void router . push ( `/docs/ ` ) ;
136+ void router . push ( `/` ) ;
137137 } else if ( treeContext && treeContext . root ) {
138138 void router . push ( `/docs/${ treeContext . root . id } ` ) . then ( ( ) => {
139139 setTimeout ( ( ) => {
@@ -193,7 +193,7 @@ export const DocTreeItemActions = ({
193193 < ModalRemoveDoc
194194 onClose = { deleteModal . onClose }
195195 doc = { doc }
196- afterDelete = { afterDelete }
196+ onSuccess = { onSuccessDelete }
197197 />
198198 ) }
199199 </ Box >
You can’t perform that action at this time.
0 commit comments