Skip to content

Commit 1659ce6

Browse files
authored
fix(dashboard): prevent double click on editing (codesandbox#6812)
1 parent c2ab3db commit 1659ce6

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

packages/app/src/app/pages/Dashboard/Components/Folder/FolderCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const FolderCard: React.FC<FolderItemComponentProps> = ({
3131
direction="vertical"
3232
gap={2}
3333
onClick={onClick}
34-
onDoubleClick={onDoubleClick}
34+
onDoubleClick={editing ? undefined : onDoubleClick}
3535
onContextMenu={onContextMenu}
3636
{...props}
3737
css={css({

packages/app/src/app/pages/Dashboard/Components/Sandbox/SandboxCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ export const SandboxCard = ({
247247
<Stack
248248
direction="vertical"
249249
onClick={onClick}
250-
onDoubleClick={onDoubleClick}
250+
onDoubleClick={editing ? undefined : onDoubleClick}
251251
onBlur={onBlur}
252252
onContextMenu={onContextMenu}
253253
{...props}

packages/app/src/app/pages/Dashboard/Components/VariableGrid/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ interface IComponentForTypes {
8080
const ComponentForTypes: IComponentForTypes = {
8181
sandbox: React.memo(props => (
8282
<Sandbox
83+
key={props.item.sandbox.id}
8384
page={props.page}
8485
item={props.item}
8586
isScrolling={props.isScrolling}
@@ -92,7 +93,7 @@ const ComponentForTypes: IComponentForTypes = {
9293
isScrolling={props.isScrolling}
9394
/>
9495
)),
95-
folder: props => <Folder {...props.item} />,
96+
folder: props => <Folder key={props.item.name} {...props.item} />,
9697
repo: props => <Repo {...props.item} isScrolling={props.isScrolling} />,
9798
'new-folder': props => <CreateFolder {...props.item} />,
9899
'new-sandbox': () => <NewSandbox />,

packages/app/src/app/pages/Profile/SandboxPicker/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export const SandboxPicker: React.FC<{ closeModal?: () => void }> = ({
114114
})}
115115
>
116116
{collectionsInPath.map(collection => (
117-
<Column key={collection.path} data-column>
117+
<Column key={`${collection.path}${collection.name}`} data-column>
118118
<FolderCard
119119
collection={collection}
120120
onClick={() => setPath(collection.path)}

0 commit comments

Comments
 (0)