@@ -5,6 +5,7 @@ import ConfirmActionModal from 'components/molecules/modals/ConfirmActionModal';
55import { isEqual } from 'lodash' ;
66import { OBJ_TYPES } from 'constants/Common' ;
77import { compare } from './util' ;
8+ import { saveHandle } from 'components/molecules/modals/SaveFlowModal' ;
89
910const tabUnsavedChanges = ( tab ) => {
1011 if ( tab . type === OBJ_TYPES . flowtest && tab . flowDataDraft ) {
@@ -36,7 +37,7 @@ const Tabs = () => {
3637 const focusTab = tabs . find ( ( t ) => t . id === focusTabId ) ;
3738 const [ confirmActionModalOpen , setConfirmActionModalOpen ] = useState ( false ) ;
3839 const closeTab = useTabStore ( ( state ) => state . closeTab ) ;
39- const [ closingTabId , setClosingTabId ] = useState ( '' ) ;
40+ const [ closingTab , setClosingTab ] = useState ( '' ) ;
4041 const [ closingCollectionId , setClosingCollectionId ] = useState ( '' ) ;
4142 // ToDo: change color according to theme
4243 const activeTabStyles = 'bg-cyan-900 text-white' ;
@@ -48,7 +49,7 @@ const Tabs = () => {
4849 event . stopPropagation ( ) ;
4950 event . preventDefault ( ) ;
5051
51- setClosingTabId ( tab . id ) ;
52+ setClosingTab ( tab ) ;
5253 setClosingCollectionId ( tab . collectionId ) ;
5354
5455 if ( tabUnsavedChanges ( tab ) ) {
@@ -94,13 +95,19 @@ const Tabs = () => {
9495 ) ;
9596 } ) }
9697 < ConfirmActionModal
97- closeFn = { ( ) => setConfirmActionModalOpen ( false ) }
98+ closeFn = { ( ) => {
99+ closeTab ( closingTab . id , closingCollectionId ) ;
100+ setConfirmActionModalOpen ( false ) ;
101+ } }
98102 open = { confirmActionModalOpen }
99103 message = { messageForConfirmActionModal }
100104 actionFn = { ( ) => {
101- closeTab ( closingTabId , closingCollectionId ) ;
105+ saveHandle ( closingTab ) ;
106+ closeTab ( closingTab . id , closingCollectionId ) ;
102107 setConfirmActionModalOpen ( false ) ;
103108 } }
109+ leftButtonMessage = { 'Close Withuout Saving' }
110+ rightButtonMessage = { 'Save And Close' }
104111 />
105112 </ div >
106113 ) ;
0 commit comments