Skip to content

fix(UI): schema upload dialog should not open if file upload dialog is open BED-8656#2903

Merged
sirisjo merged 3 commits into
mainfrom
BED-8656-schema-upload
Jun 22, 2026
Merged

fix(UI): schema upload dialog should not open if file upload dialog is open BED-8656#2903
sirisjo merged 3 commits into
mainfrom
BED-8656-schema-upload

Conversation

@sirisjo

@sirisjo sirisjo commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Description

There was a bug on the OpenGraph Management page where if you were on the OpenGraph Management page and then clicked "Quick Upload", the Quick Upload dialog opens; but then if you attempt to drag a file into the dialog, the Schema Upload Dialog would also open behind it, and the UI sort of breaks. The file is attached to the Schema Upload dialog but is not visible which is a confusing experience. This change updates the Schema Upload dialog to not open if the Quick Upload dialog is already open.

Motivation and Context

Resolves BED-8656

Solves the bug where both dialogs would open at the same time.

How Has This Been Tested?

Tested locally following the instructions in the ticket. Also added a new test for this case.

Screenshots (optional):

Screen.Recording.2026-06-17.at.15.19.40.mov

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

Summary by CodeRabbit

  • Tests

    • Added coverage to verify the schema upload dialog does not open from drag-and-drop when another file ingest dialog is already active.
  • Bug Fixes

    • Improved schema drag-and-drop handling so the “Upload Schema Files” dialog won’t appear if an ingest/upload dialog is currently displayed, while preserving existing behavior when uploads are permitted and no ingest dialog is showing.

@sirisjo sirisjo self-assigned this Jun 17, 2026
@sirisjo sirisjo added bug Something isn't working user interface A pull request containing changes affecting the UI code. javascript Pull requests that update javascript code labels Jun 17, 2026
@coderabbitai

coderabbitai Bot commented Jun 17, 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: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: e83901de-4153-4b7b-9d95-668adad0ecdf

📥 Commits

Reviewing files that changed from the base of the PR and between e374673 and 6b605a4.

📒 Files selected for processing (1)
  • packages/javascript/bh-shared-ui/src/components/SchemaUploadDialog/SchemaUploadDialog.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/javascript/bh-shared-ui/src/components/SchemaUploadDialog/SchemaUploadDialog.test.tsx

📝 Walkthrough

Walkthrough

SchemaUploadDialog now reads showFileIngestDialog from useFileUploadDialogContext and computes a memoized shouldRespondToDrag predicate that combines upload permission with the absence of the ingest dialog. This predicate is passed as the condition to useExecuteOnFileDrag. The test suite adds a mock for the context and a new test case asserting drag-triggered dialog opening is suppressed when the ingest dialog is already open.

Changes

Drag condition gating in SchemaUploadDialog

Layer / File(s) Summary
shouldRespondToDrag predicate and useExecuteOnFileDrag wiring
packages/javascript/bh-shared-ui/src/components/SchemaUploadDialog/SchemaUploadDialog.tsx
Imports useCallback and useFileUploadDialogContext, reads showFileIngestDialog, and creates a memoized predicate passed as condition to useExecuteOnFileDrag to suppress drag handling when the ingest dialog is active.
Test mock and drag-suppression test case
packages/javascript/bh-shared-ui/src/components/SchemaUploadDialog/SchemaUploadDialog.test.tsx
Adds showFileIngestDialogMock, mocks useFileUploadDialogContext to use it, resets the flag in afterEach, and adds a test asserting the upload dialog does not open on dragenter when the mock flag is true.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: preventing the schema upload dialog from opening when the file upload dialog is already open, with reference to the associated ticket BED-8656.
Description check ✅ Passed The description includes all required sections: detailed problem description, motivation/context with ticket reference, testing methodology, screenshots, change type, and completed checklist items.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch BED-8656-schema-upload

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/javascript/bh-shared-ui/src/components/SchemaUploadDialog/SchemaUploadDialog.test.tsx`:
- Around line 140-143: The test creates a bare Event object for the dragenter
event which lacks the required dataTransfer property, preventing proper
isolation of the condition logic in the useExecuteOnFileDrag hook. Replace the
new Event('dragenter') with a proper DragEvent that includes a dataTransfer
property with types set to ['Files']. This will ensure the dataTransfer
validation passes and the test can properly verify that the condition check
(checking if showFileIngestDialog is true) is what actually prevents the dialog
from opening, making the test fail if this condition logic is accidentally
removed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 42f2f691-cefb-41d2-a96a-f0a34fec923c

📥 Commits

Reviewing files that changed from the base of the PR and between 24079d4 and ca34c5c.

📒 Files selected for processing (2)
  • packages/javascript/bh-shared-ui/src/components/SchemaUploadDialog/SchemaUploadDialog.test.tsx
  • packages/javascript/bh-shared-ui/src/components/SchemaUploadDialog/SchemaUploadDialog.tsx

@Holocraft Holocraft left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@sirisjo sirisjo merged commit dcc98e0 into main Jun 22, 2026
13 checks passed
@sirisjo sirisjo deleted the BED-8656-schema-upload branch June 22, 2026 19:09
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working javascript Pull requests that update javascript code user interface A pull request containing changes affecting the UI code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants