Skip to content

Commit

Permalink
fix: state for button label is not updating
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamv-ss committed Sep 10, 2024
1 parent 8006a35 commit 2a4aafe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { useFetchDocumentByIdMutation } from 'features/apps/apiSlice'
import CommonService from 'services/CommonService'
import type { UseCaseType } from 'features/appManagement/types'
import type { RootState } from 'features/store'

import { resetDialog } from 'features/overlay/slice'
export interface AppDetailHeaderProps {
item: AppDetails
}
Expand Down Expand Up @@ -74,6 +74,12 @@ export default function AppDetailHeader({ item }: AppDetailHeaderProps) {
}
}

useEffect(() => {
return () => {
dispatch(resetDialog())
}
}, [dispatch])

useEffect(() => {
if (isDialogConfirmed) {
setButtonLabel(t('content.appdetail.requested'))
Expand Down
1 change: 1 addition & 0 deletions src/features/overlay/slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const dialog = createSlice({
},
resetDialog: (state) => {
state.isConfirmed = false
state.isOpen = false
},
},
})
Expand Down

0 comments on commit 2a4aafe

Please sign in to comment.