Skip to content

Commit 35760a3

Browse files
committed
Merge branch 'master' of github.com:CompuIves/codesandbox-client
2 parents d07516d + 33a33af commit 35760a3

File tree

12 files changed

+43
-42
lines changed

12 files changed

+43
-42
lines changed

packages/app/src/app/components/DeploymentIntegration/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import Down from 'react-icons/lib/fa/angle-down';
33
import Up from 'react-icons/lib/fa/angle-up';
4-
import Notice from 'common/lib/components/Notice';
4+
import Notice from '@codesandbox/common/lib/components/Notice';
55
import DetailInfo from './DetailInfo';
66
import { Container, IntegrationBlock, Name } from './elements';
77

@@ -40,7 +40,6 @@ const Integration = ({
4040
width: 1.5rem;
4141
height: auto;
4242
`}
43-
onClick={toggle}
4443
/>
4544
) : (
4645
<Down
@@ -50,7 +49,6 @@ const Integration = ({
5049
width: 1.5rem;
5150
height: auto;
5251
`}
53-
onClick={toggle}
5452
/>
5553
)}
5654
</IntegrationBlock>

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22

33
import MoreInfoIcon from 'react-icons/lib/md/arrow-drop-down';
4+
import Tooltip from '@codesandbox/common/lib/components/Tooltip';
45

56
import {
67
Title,
@@ -52,18 +53,16 @@ function ActionComponent({
5253
}: Props) {
5354
if (!href && (placeholder || tooltip)) {
5455
return (
55-
<ActionTooltip
56-
content={placeholder || tooltip}
57-
hideOnClick={false}
58-
{...props}
59-
>
60-
<IconContainer onClick={onClick} {...iconContainerProps}>
61-
<Icon {...iconProps} />
62-
{title !== undefined && <Title>{title}</Title>}
63-
{moreInfo && <MoreInfoIcon style={{ fontSize: '1.1rem' }} />}
64-
</IconContainer>
65-
{children}
66-
</ActionTooltip>
56+
<Action {...props}>
57+
<Tooltip content={placeholder || tooltip} hideOnClick={false}>
58+
<IconContainer onClick={onClick} {...iconContainerProps}>
59+
<Icon {...iconProps} />
60+
{title !== undefined && <Title>{title}</Title>}
61+
{moreInfo && <MoreInfoIcon style={{ fontSize: '1.1rem' }} />}
62+
</IconContainer>
63+
{children}
64+
</Tooltip>
65+
</Action>
6766
);
6867
}
6968
if (onClick) {

packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Deployment/Netlify.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import LinkIcon from 'react-icons/lib/fa/external-link';
44
import Cogs from 'react-icons/lib/fa/cogs';
55
import NetlifyLogo from 'app/components/NetlifyLogo';
66
import DeploymentIntegration from 'app/components/DeploymentIntegration';
7-
import getTemplate from 'common/lib/templates';
8-
import { Button } from 'common/lib/components/Button';
7+
import getTemplate from '@codesandbox/common/lib/templates';
8+
import { Button } from '@codesandbox/common/lib/components/Button';
99
import { WorkspaceInputContainer, WorkspaceSubtitle } from '../../elements';
1010
import {
1111
Deploys,
@@ -86,7 +86,7 @@ class NetlifyDeployment extends Component {
8686
>
8787
{deployment.building ? (
8888
<>
89-
<Cogs /> Building
89+
<Cogs /> Building...
9090
</>
9191
) : (
9292
<>

packages/app/src/app/pages/common/Modals/NetlifyLogs/elements.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ export const List = styled.ul`
1313
padding: 1.3em;
1414
list-style: none;
1515
font-family: 'dm';
16-
background: #1b1d1f;
16+
background: ${props => props.theme.background4};
1717
max-height: 400px;
1818
overflow: auto;
19-
margin-bottom: 1.3em;
19+
margin: 1.3em 0;
2020
word-break: break-word;
21+
border-radius: 4px;
2122
`;
2223

2324
export const Item = styled.li`

packages/app/src/app/pages/common/Modals/NetlifyLogs/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { Component } from 'react';
22
import { inject, observer } from 'mobx-react';
33

4-
import { Button } from 'common/lib/components/Button';
4+
import { Button } from '@codesandbox/common/lib/components/Button';
55
import { Container } from '../LiveSessionEnded/elements';
66
import { Heading, Explanation } from '../elements';
77

@@ -35,7 +35,9 @@ class NetlifyLogs extends Component {
3535
Builds typically take a minute or two to complete
3636
</Explanation>
3737
<List>{this.state.logs.map(log => <Item key={log}>{log}</Item>)}</List>
38-
<Button onClick={() => signals.modalClosed()}>Close</Button>
38+
<Button small onClick={() => signals.modalClosed()}>
39+
Close
40+
</Button>
3941
</Container>
4042
);
4143
}

packages/app/src/sandbox/compile.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import parseConfigurations from '@codesandbox/common/lib/templates/configuration
55
import initializeErrorTransformers from 'sandbox-hooks/errors/transformers';
66
import { inject, unmount } from 'sandbox-hooks/react-error-overlay/overlay';
77
import { isBabel7 } from '@codesandbox/common/lib/utils/is-babel-7';
8-
import getDefinition, { TemplateType } from '@codesandbox/common/lib/templates/index';
8+
import getDefinition, {
9+
TemplateType,
10+
} from '@codesandbox/common/lib/templates/index';
911

1012
import getPreset from './eval';
1113
import Manager, { Manifest } from './eval/manager';
@@ -647,7 +649,7 @@ async function compile({
647649
manager.clearCache();
648650

649651
if (firstLoad && changedModuleCount === 0) {
650-
deleteAPICache(manager.id);
652+
await deleteAPICache(manager.id);
651653
}
652654
}
653655

packages/app/src/sandbox/eval/cache.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ function shouldSaveOnlineCache(firstRun: boolean, changes: number) {
3939
return false;
4040
}
4141

42+
export function clearIndexedDBCache() {
43+
return localforage.clear();
44+
}
45+
4246
export async function saveCache(
4347
sandboxId: string,
4448
managerModuleToTranspile: any,
@@ -64,7 +68,7 @@ export async function saveCache(
6468
debug(
6569
'Saving cache of ' +
6670
(JSON.stringify(managerState).length / 1024).toFixed(2) +
67-
'kb to localStorage'
71+
'kb to indexedDB'
6872
);
6973
}
7074
localforage.setItem(manager.id, managerState);
@@ -111,7 +115,7 @@ export async function saveCache(
111115
return Promise.resolve(false);
112116
}
113117

114-
export function deleteAPICache(sandboxId: string) {
118+
export function deleteAPICache(sandboxId: string): Promise<any> {
115119
if (APICacheUsed) {
116120
debug('Deleting cache of API');
117121
return window

packages/app/src/sandbox/eval/manager.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { flattenDeep, uniq, values } from 'lodash-es';
33
import { Protocol } from 'codesandbox-api';
44
import resolve from 'browser-resolve';
5-
import localforage from 'localforage';
65

76
import * as pathUtils from '@codesandbox/common/lib/utils/path';
87
import _debug from '@codesandbox/common/lib/utils/debug';
@@ -24,7 +23,7 @@ import TestRunner from './tests/jest-lite';
2423
import dependenciesToQuery from '../npm/dependencies-to-query';
2524
import { packageFilter } from './utils/resolve-utils';
2625

27-
import { ignoreNextCache, deleteAPICache } from './cache';
26+
import { ignoreNextCache, deleteAPICache, clearIndexedDBCache } from './cache';
2827
import { shouldTranspile } from './transpilers/babel/check';
2928
import { getGlobal } from '@codesandbox/common/lib/utils/global';
3029
import { ParsedConfigurationFiles } from '@codesandbox/common/lib/templates/template';
@@ -1165,12 +1164,12 @@ export default class Manager {
11651164

11661165
deleteAPICache() {
11671166
ignoreNextCache();
1168-
deleteAPICache(this.id);
1167+
return deleteAPICache(this.id);
11691168
}
11701169

11711170
clearCache() {
11721171
try {
1173-
localforage.clear();
1172+
clearIndexedDBCache();
11741173
} catch (ex) {
11751174
if (process.env.NODE_ENV === 'development') {
11761175
console.error(ex);

packages/app/src/sandbox/eval/transpiled-module.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -789,10 +789,12 @@ export default class TranspiledModule {
789789
// We're in a reload loop! Ignore all caches!
790790

791791
manager.clearCache();
792-
manager.deleteAPICache();
792+
manager.deleteAPICache().then(() => {
793+
document.location.reload();
794+
});
795+
} else {
796+
document.location.reload();
793797
}
794-
795-
location.reload();
796798
return {};
797799
}
798800
} else if (

packages/common/src/components/Preview/Navigator/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import React from 'react';
32

43
import LeftIcon from 'react-icons/lib/fa/angle-left';
@@ -82,7 +81,7 @@ function Navigator({
8281
<Tooltip
8382
delay={0}
8483
content={isProjectView ? 'Project View' : 'Current Module View'}
85-
position="left"
84+
placement="left"
8685
>
8786
<Switch
8887
offMode
@@ -98,4 +97,4 @@ function Navigator({
9897
);
9998
}
10099

101-
export default Navigator
100+
export default Navigator;

0 commit comments

Comments
 (0)