Skip to content

Commit 5294b9b

Browse files
christianalfoniCompuIves
authored andcommitted
Fix nested dashboard and wrong usage of mobx (codesandbox#2491)
1 parent 597c3e4 commit 5294b9b

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

packages/app/src/app/custom.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.svg' {
2+
const content: any;
3+
export default content;
4+
}

packages/app/src/app/pages/Dashboard/Sidebar/SandboxesItem/FolderEntry/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type Props = {
4343
url: string;
4444
folders: { path: string }[];
4545
foldersByPath: { [path: string]: string };
46+
selectedSandboxes: string[];
4647
depth: number;
4748
toToggle?: boolean;
4849
allowCreate?: boolean;
@@ -122,6 +123,7 @@ class FolderEntry extends React.Component<Props, State> {
122123
path,
123124
url,
124125
folders,
126+
selectedSandboxes,
125127
foldersByPath,
126128
depth,
127129
isOver,
@@ -343,6 +345,7 @@ class FolderEntry extends React.Component<Props, State> {
343345
return (
344346
<DropFolderEntry
345347
path={childPath}
348+
selectedSandboxes={selectedSandboxes}
346349
url={childUrl}
347350
basePath={basePath}
348351
teamId={teamId}

packages/app/src/app/pages/Dashboard/Sidebar/SandboxesItem/folder-drop-target.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import { basename, join } from 'path';
2+
13
import { client } from 'app/graphql/client';
2-
import { join, basename } from 'path';
34

45
import {
56
ADD_SANDBOXES_TO_FOLDER_MUTATION,
6-
RENAME_FOLDER_MUTATION,
77
PATHED_SANDBOXES_CONTENT_QUERY,
8+
RENAME_FOLDER_MUTATION,
89
} from '../../queries';
910

1011
function addSandboxesToCollection(props, item) {
@@ -15,9 +16,7 @@ function addSandboxesToCollection(props, item) {
1516
variables: {
1617
collectionPath: path || '/',
1718
teamId,
18-
sandboxIds: selectedSandboxes.toJS
19-
? selectedSandboxes.toJS()
20-
: selectedSandboxes,
19+
sandboxIds: selectedSandboxes,
2120
},
2221
optimisticResponse: {
2322
__typename: 'Mutation',

packages/app/src/app/pages/Sandbox/Editor/Header/index.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1+
// @ts-ignore
2+
// eslint-disable-next-line import/no-unresolved,import/no-webpack-loader-syntax
13
import { Button } from '@codesandbox/common/lib/components/Button';
24
import ProgressButton from '@codesandbox/common/lib/components/ProgressButton';
35
import Margin from '@codesandbox/common/lib/components/spacing/Margin';
46
import {
57
dashboardUrl,
68
patronUrl,
79
} from '@codesandbox/common/lib/utils/url-generator';
8-
import { toJS } from 'mobx';
9-
import { inject, hooksObserver } from 'app/componentConnectors';
10+
import { hooksObserver, inject } from 'app/componentConnectors';
11+
import { LikeHeart } from 'app/pages/common/LikeHeart';
12+
import { SignInButton } from 'app/pages/common/SignInButton';
13+
import { UserMenu } from 'app/pages/common/UserMenu';
14+
import { saveAllModules } from 'app/store/modules/editor/utils';
15+
import { json } from 'overmind';
1016
import * as React from 'react';
1117
import PlusIcon from 'react-icons/lib/go/plus';
1218
import Fork from 'react-icons/lib/go/repo-forked';
1319
import SaveIcon from 'react-icons/lib/md/save';
1420
import SettingsIcon from 'react-icons/lib/md/settings';
1521
import ShareIcon from 'react-icons/lib/md/share';
16-
17-
import { LikeHeart } from 'app/pages/common/LikeHeart';
18-
import { SignInButton } from 'app/pages/common/SignInButton';
19-
import { UserMenu } from 'app/pages/common/UserMenu';
20-
import { saveAllModules } from 'app/store/modules/editor/utils';
21-
// @ts-ignore
22-
// eslint-disable-next-line import/no-unresolved,import/no-webpack-loader-syntax
2322
import PatronBadge from '-!svg-react-loader!@codesandbox/common/lib/utils/badges/svg/patron-4.svg';
2423

2524
import { Action } from './Buttons/Action';
@@ -193,7 +192,7 @@ const HeaderComponent = ({ zenMode, store, signals }: Props) => {
193192
<CollectionInfo
194193
isLoggedIn={store.isLoggedIn}
195194
// Passing a clone of observable requires it to be called in render of observer
196-
sandbox={toJS(sandbox)}
195+
sandbox={json(sandbox)}
197196
/>
198197
</Centered>
199198
)}

0 commit comments

Comments
 (0)