@@ -188,7 +188,7 @@ const UpgradeToProModal = ({ isOpen, onClose }) => {
188188
189189const MANUAL_INTEGRATION_CONFIGS = { } // Manual integrations removed for Slack and Notion
190190
191- const WhatsAppQRCodeModal = ( { onClose, onSuccess } ) => {
191+ const WhatsAppQRCodeModal = ( { onClose } ) => {
192192 const [ qrCode , setQrCode ] = useState ( null )
193193 const [ status , setStatus ] = useState ( "initiating" ) // initiating, scanning, working, error
194194 const [ error , setError ] = useState ( "" )
@@ -214,7 +214,6 @@ const WhatsAppQRCodeModal = ({ onClose, onSuccess }) => {
214214 setStatus ( "working" )
215215 stopPolling ( )
216216 toast . success ( "WhatsApp connected successfully!" )
217- onSuccess ( )
218217 setTimeout ( onClose , 1500 )
219218 } else if ( data . status === "FAILED" ) {
220219 setError ( "Connection failed. Please close this and try again." )
@@ -228,7 +227,7 @@ const WhatsAppQRCodeModal = ({ onClose, onSuccess }) => {
228227 setStatus ( "error" )
229228 stopPolling ( )
230229 }
231- } , [ onSuccess , onClose , stopPolling ] )
230+ } , [ onClose , stopPolling ] )
232231
233232 const initiateConnection = useCallback ( async ( ) => {
234233 setStatus ( "initiating" )
@@ -765,6 +764,7 @@ const IntegrationsPage = () => {
765764
766765 const handleWhatsAppModalClose = useCallback ( ( ) => {
767766 setIsWhatsAppQRModalOpen ( false )
767+ fetchIntegrations ( ) // Always refetch on close to ensure UI is up-to-date
768768 } , [ ] )
769769
770770 const googleServices = [
@@ -782,8 +782,8 @@ const IntegrationsPage = () => {
782782 setLoading ( true )
783783 try {
784784 const response = await fetch ( "/api/settings/integrations" , {
785- cache : "no-store " ,
786- method : "POST "
785+ method : "POST " ,
786+ cache : "no-store "
787787 } )
788788 const data = await response . json ( )
789789 if ( ! response . ok )
@@ -1546,10 +1546,7 @@ const IntegrationsPage = () => {
15461546 </ div >
15471547 < AnimatePresence >
15481548 { isWhatsAppQRModalOpen && (
1549- < WhatsAppQRCodeModal
1550- onClose = { handleWhatsAppModalClose }
1551- onSuccess = { fetchIntegrations }
1552- />
1549+ < WhatsAppQRCodeModal onClose = { handleWhatsAppModalClose } />
15531550 ) }
15541551 </ AnimatePresence >
15551552 < AnimatePresence >
0 commit comments