Skip to content

fix: reset dialog state and abort in-flight test on cancel (#2048)#2069

Closed
hunterxtang wants to merge 1 commit into
langflow-ai:mainfrom
hunterxtang:fix/2048-azure-blob-dialog-state-reset
Closed

fix: reset dialog state and abort in-flight test on cancel (#2048)#2069
hunterxtang wants to merge 1 commit into
langflow-ai:mainfrom
hunterxtang:fix/2048-azure-blob-dialog-state-reset

Conversation

@hunterxtang

@hunterxtang hunterxtang commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Fixes #2048 on main.

Root cause

Connector settings dialogs (Azure Blob, S3, IBM COS) are rendered
unconditionally in connector-cards.tsx with a stable key, so the
component never unmounts when the user closes the dialog. All
useState and useForm state — the connection-string field value,
the formError "Test the connection first…" message, and the
isFetchingContainers loading flag — survive Cancel and reappear on
the next open.

Additionally, the Azure Blob test-connection handler called
fetch("/api/connectors/azure_blob/test") with no AbortController.
Clicking Cancel while a test was in flight left isFetchingContainers
stuck at true until the underlying TCP connection timed out, keeping
the button locked on "Connecting…" on reopen.

Fix

1 — connector-cards.tsx: unmount on close

Render each SettingsDialog only while openDialog === descriptor.connectorType;
return null otherwise. The component unmounts on close, React destroys all
internal state, and every field and error message is fresh on the next open.
This also resolves the same latent stale-state bug in the S3 and IBM COS
dialogs at no extra cost, since they go through the same rendering loop.

2 — azure-blob/settings-dialog.tsx: AbortController on the test fetch

  • A useRef<AbortController | null> tracks the currently in-flight test request.
  • At the top of handleTestConnection, any prior call is aborted before a new
    controller is created — cancels a stuck request if the user clicks the button
    twice.
  • signal: controller.signal is passed to fetch; AbortError is caught and
    swallowed silently (no error state set to the user).
  • A useEffect cleanup aborts on unmount, so closing the dialog mid-request
    immediately cancels the network call rather than letting it run to TCP timeout.
  • The finally block is guarded with testAbortRef.current === controller so
    that an aborted call's finally does not clear isFetchingContainers while a
    superseding request is still in flight (prevents spinner flicker).

Known tradeoff

Unmount-on-close skips the Radix exit animation — the dialog disappears
immediately rather than fading out. Intentional; correctness takes priority over
the transition.

Deferred follow-up

S3 (s3-settings-dialog.tsx) and IBM COS (ibm-cos/settings-dialog.tsx) both
use a mutateAsync + raw fetch sequence in their test paths. The raw fetch
portion is equally abortable, but adding AbortController to both is deferred
to keep this PR scoped to #2048.

Verification

Summary by CodeRabbit

  • Bug Fixes
    • Improved connector settings dialogs so they close and reset cleanly.
    • Cancelled previous connection tests when a new test starts or the dialog closes.
    • Prevented cancelled requests from showing errors or incorrectly changing loading indicators.

@github-actions github-actions Bot added the frontend 🟨 Issues related to the UI/UX label Jul 9, 2026
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7ba0197b-95d8-4e5d-8c75-b84a2c55ca0e

📥 Commits

Reviewing files that changed from the base of the PR and between 7e036f0 and 4a2d325.

📒 Files selected for processing (2)
  • frontend/app/settings/_components/connector-cards.tsx
  • frontend/enhancements/connectors/azure-blob/settings-dialog.tsx

Walkthrough

Connector settings dialogs now unmount when closed. Azure Blob connection tests cancel prior or unmounted requests, suppress abort errors, and preserve loading state for the currently active request.

Changes

Connector dialog reliability

Layer / File(s) Summary
Unmount closed connector dialogs
frontend/app/settings/_components/connector-cards.tsx
Only the active connector’s settings dialog is mounted, with open={true} while rendered.
Cancel Azure Blob test requests
frontend/enhancements/connectors/azure-blob/settings-dialog.tsx
AbortController cancels replaced or unmounted requests, ignores abort errors, and prevents stale requests from clearing loading state.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: mfortman11, edwinjosechittilappilly

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main fix: resetting dialog state and aborting in-flight tests on cancel.
Linked Issues check ✅ Passed The changes match #2048 by unmounting dialogs on close and aborting Azure Blob test requests to reset stale state.
Out of Scope Changes check ✅ Passed The S3 and IBM COS dialog unmount behavior and Azure Blob abort cleanup are aligned with the stated PR objectives.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the bug 🔴 Something isn't working. label Jul 9, 2026
@hunterxtang
hunterxtang marked this pull request as ready for review July 9, 2026 21:46
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
putComment timed out

@hunterxtang
hunterxtang force-pushed the fix/2048-azure-blob-dialog-state-reset branch from 10ceb00 to 4a2d325 Compare July 10, 2026 15:56
@github-actions github-actions Bot added bug 🔴 Something isn't working. and removed bug 🔴 Something isn't working. labels Jul 10, 2026
@hunterxtang

Copy link
Copy Markdown
Collaborator Author

Superseded by #2072 — re-landed on an in-repo branch so the secret-dependent checks (build-images, e2e) can run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🔴 Something isn't working. frontend 🟨 Issues related to the UI/UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Azure Blog Storage Connector: "Azure Blob Storage Setup" dialog caches previous field state and error messages on cancel

1 participant