-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with circular import (#8078)
A recent PR introduced issues with circular imports in `categorySwitcher.ts` - the reason why this wasn't found before merge is because bundlers work fine with circular imports - it's just GUI2's dev mode that doesn't do well with them # Important Notes None
- Loading branch information
1 parent
c582571
commit b039f92
Showing
4 changed files
with
43 additions
and
44 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
31 changes: 31 additions & 0 deletions
31
app/ide-desktop/lib/dashboard/src/authentication/src/dashboard/drag.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** @file Various types of drag event payloads. */ | ||
|
||
import type * as backend from './backend' | ||
|
||
// ============================ | ||
// === AssetRowsDragPayload === | ||
// ============================ | ||
|
||
export const ASSET_ROWS_DRAG_PAYLOAD_MIMETYPE = 'application/x-enso-asset-list' | ||
const ASSET_ROWS_DRAG_PAYLOAD_MIMETYPE_REGEX = new RegExp( | ||
'^' + ASSET_ROWS_DRAG_PAYLOAD_MIMETYPE + '; id=(.+)$' | ||
) | ||
export const ASSET_ROWS_DRAG_PAYLOAD_MAP = new Map<string, AssetRowsDragPayload>() | ||
|
||
/** Resolve to an {@link AssetRowsDragPayload}, if any, else resolve to `null`. */ | ||
export function tryGetAssetRowsDragPayload(dataTransfer: DataTransfer) { | ||
const item = Array.from(dataTransfer.items).find(dataTransferItem => | ||
dataTransferItem.type.startsWith(ASSET_ROWS_DRAG_PAYLOAD_MIMETYPE) | ||
) | ||
const id = item?.type.match(ASSET_ROWS_DRAG_PAYLOAD_MIMETYPE_REGEX)?.[1] ?? null | ||
return id != null ? ASSET_ROWS_DRAG_PAYLOAD_MAP.get(id) ?? null : null | ||
} | ||
|
||
/** Metadata for an asset row. */ | ||
interface AssetRowsDragPayloadItem { | ||
key: backend.AssetId | ||
asset: backend.AnyAsset | ||
} | ||
|
||
/** Data for a {@link DragEvent} started from an {@link AssetsTable}. */ | ||
export type AssetRowsDragPayload = AssetRowsDragPayloadItem[] |