Skip to content

Commit 743b163

Browse files
authored
fix(dashboard): cloud sandboxes redirects on recent page (#6995)
1 parent 020a30b commit 743b163

File tree

1 file changed

+21
-18
lines changed
  • packages/app/src/app/pages/Dashboard/Components/Sandbox

1 file changed

+21
-18
lines changed

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

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ const GenericSandbox = ({ isScrolling, item, page }: GenericSandboxProps) => {
148148
const selected = selectedIds.includes(sandbox.id);
149149
const isDragging = isAnythingDragging && selected;
150150

151+
const sandboxAnalyticsEvent = !autoFork
152+
? MAP_SANDBOX_EVENT_TO_PAGE_TYPE[page]
153+
: null;
154+
151155
const onClick = event => {
152156
onSelectionClick(event, sandbox.id);
153157
};
@@ -169,10 +173,6 @@ const GenericSandbox = ({ isScrolling, item, page }: GenericSandboxProps) => {
169173
return;
170174
}
171175

172-
const sandboxAnalyticsEvent = !autoFork
173-
? MAP_SANDBOX_EVENT_TO_PAGE_TYPE[page]
174-
: null;
175-
176176
// Templates in Home should fork, everything else opens
177177
if (event.ctrlKey || event.metaKey) {
178178
if (autoFork) {
@@ -246,32 +246,35 @@ const GenericSandbox = ({ isScrolling, item, page }: GenericSandboxProps) => {
246246
onSubmit();
247247
}, [onSubmit]);
248248

249+
const baseInteractions = {
250+
selected,
251+
onBlur,
252+
onContextMenu,
253+
};
249254
const interactionProps =
250255
page === 'recent'
251256
? {
252-
selected,
253-
as: Link,
254-
to: url,
257+
...baseInteractions,
258+
as: sandbox.isV2 ? 'a' : Link,
259+
to: sandbox.isV2 ? undefined : url,
260+
href: sandbox.isV2 ? url : undefined,
261+
onClick: () => {
262+
if (sandboxAnalyticsEvent) {
263+
trackImprovedDashboardEvent(sandboxAnalyticsEvent);
264+
}
265+
},
255266
style: {
256267
outline: 'none',
257268
textDecoration: 'none',
258269
},
259-
onBlur,
260-
onContextMenu,
261270
}
262271
: {
263-
tabIndex: 0, // make div focusable
264-
style: {
265-
outline: 'none',
266-
}, // we handle outline with border
267-
selected,
272+
...baseInteractions,
273+
// Recent page does not support selection
274+
'data-selection-id': sandbox.id,
268275
onClick,
269276
onMouseDown,
270277
onDoubleClick,
271-
onContextMenu,
272-
onBlur,
273-
// Recent page does not support selection
274-
'data-selection-id': sandbox.id,
275278
};
276279

277280
const sandboxProps = {

0 commit comments

Comments
 (0)