Skip to content

Commit 0f23331

Browse files
committed
fix(oauth): preserve workflow return context
1 parent 102e5b4 commit 0f23331

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

apps/sim/app/workspace/[workspaceId]/components/connect-oauth-modal/connect-oauth-modal.test.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ describe('ConnectOAuthModal reauthorization', () => {
336336
})
337337

338338
it('collects QuickBooks app credentials inside the standard OAuth connection flow', async () => {
339+
const onOpenChange = vi.fn()
339340
mocks.getServiceConfigByProviderId.mockReturnValue({
340341
clientConfiguration: {
341342
redirectPath: '/api/auth/oauth2/callback/quickbooks',
@@ -371,7 +372,7 @@ describe('ConnectOAuthModal reauthorization', () => {
371372
<ConnectOAuthModal
372373
mode='connect'
373374
open={true}
374-
onOpenChange={vi.fn()}
375+
onOpenChange={onOpenChange}
375376
providerId='quickbooks'
376377
workspaceId='workspace-1'
377378
requiredScopes={[]}
@@ -423,5 +424,11 @@ describe('ConnectOAuthModal reauthorization', () => {
423424
},
424425
})
425426
)
427+
expect(mocks.writeOAuthReturnContext).toHaveBeenCalledOnce()
428+
expect(mocks.clearOAuthReturnContext).not.toHaveBeenCalled()
429+
expect(onOpenChange).toHaveBeenCalledWith(false)
430+
expect(mocks.writeOAuthReturnContext.mock.invocationCallOrder[0]).toBeLessThan(
431+
onOpenChange.mock.invocationCallOrder[0]
432+
)
426433
})
427434
})

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5355,7 +5355,6 @@ const WorkflowContent = React.memo(
53555355
open={true}
53565356
onOpenChange={(open) => {
53575357
if (!open) {
5358-
consumeOAuthReturnContext()
53595358
setOauthModal(null)
53605359
}
53615360
}}

0 commit comments

Comments
 (0)