Skip to content

Commit

Permalink
fix(cdk:drag-drop): the shard context was not initalized correctly (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
danranVm committed Apr 17, 2023
1 parent daa39da commit 1a8793d
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions packages/cdk/drag-drop/src/utils.ts
Expand Up @@ -19,15 +19,12 @@ const useDnDContext = createSharedComposable(useDragDropContext)
* @param targetContext
*/
export const initContext = (targetContext?: DnDContext): DnDContext => {
let context = {} as DnDContext
// default context is window
if (!targetContext) {
const root = document as unknown as HTMLElement
const context = useDnDContext(root)
if (!_dnDContextMap.has(root)) {
context = useDnDContext(root)
_dnDContextMap.set(root, context)
} else {
context = _dnDContextMap.get(root)!
}
return context
}
Expand Down

0 comments on commit 1a8793d

Please sign in to comment.