feat: support multiple independent Board instances (v0) [WIP] - #448
Draft
ernst-dev wants to merge 1 commit into
Draft
feat: support multiple independent Board instances (v0) [WIP]#448ernst-dev wants to merge 1 commit into
ernst-dev wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #448 +/- ##
==========================================
+ Coverage 91.44% 92.17% +0.73%
==========================================
Files 59 62 +3
Lines 1730 1751 +21
Branches 467 468 +1
==========================================
+ Hits 1582 1614 +32
+ Misses 148 137 -11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
[WIP / first-cut v0] Enables multiple independent
Boardinstances on a single page.Today the drag-and-drop
DragAndDropControlleris a module-level singleton shared by everyBoard/ItemsPaletteon the page (src/internal/dnd-controller/controller.ts). All droppables register into one shared registry, so collisions and drops "leak" between boards and independent boards cannot be isolated.This change makes the DnD controller context-scoped and adds an opt-in provider:
DragAndDropControlleris now exported and the DnD hooks (useDragSubscription,useDraggable,useDroppable) read their controller from a new React context (DndControllerContext).DndContextProvidermints a dedicated controller per subtree.BoardDndProvidercomponent wraps board components in an isolated DnD context:BoardDndProvider→ boards are fully isolated.BoardDndProvider→ they share a context and items can be dragged between them.display: contentsso it is layout-neutral.This is additive and opt-in. It is a coherent, buildable v0 to unblock the epic; it is not feature-complete (see remaining work).
Related links, issue #, if available: Tracking SIM AWSUI-56573.
Done in this PR (v0)
DndContextProvider(internal) + publicBoardDndProvider(+ interfaces, styles, index export).findBoardDndProvider/findAllBoardDndProviders).pages/board-dnd-provider/multi-instance.page.tsx(isolated boards + shared group).Remaining work (follow-ups, out of scope for v0)
BoardDndProvidervs. a prop onBoard) and naming with the team.How has this been tested?
npm run build— green.npm run test:unit— 336 passed / 34 files (incl. newdnd-contexttests; snapshots regenerated).eslint .— 0 errors (pre-existing warnings only).test:functional/test:visual(Puppeteer e2e) — tracked as follow-up.Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md. (yes — context defaults to the existing singleton)CONTRIBUTING.md.Security
checkSafeUrlfunction. (n/a)Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.