Skip to content

Commit 35d3272

Browse files
author
Ives van Hoorne
committed
Allow 0 dependencies
1 parent eb96879 commit 35d3272

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

src/app/components/sandbox/Preview/index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ type Props = {
4646
errors: ?Array<ModuleError>,
4747
hideNavigation?: boolean,
4848
setFrameHeight: ?(height: number) => any,
49+
dependencies: Object,
4950
};
5051

5152
type State = {
@@ -211,15 +212,19 @@ export default class Preview extends React.PureComponent {
211212
module,
212213
externalResources,
213214
preferences,
215+
dependencies,
214216
} = this.props;
215217
if (preferences.clearConsoleEnabled) {
216218
console.clear();
217219
}
218-
if (bundle.externals == null) {
219-
if (!bundle.processing && !bundle.error) {
220-
this.fetchBundle();
220+
221+
if (Object.keys(dependencies).length > 0) {
222+
if (bundle.externals == null) {
223+
if (!bundle.processing && !bundle.error) {
224+
this.fetchBundle();
225+
}
226+
return;
221227
}
222-
return;
223228
}
224229
// Do it here so we can see the dependency fetching screen if needed
225230
this.clearErrors();

src/app/pages/Profile/Showcase/ShowcasePreview.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ import { preferencesSelector } from '../../../store/preferences/selectors';
1818

1919
const Container = styled.div`
2020
position: relative;
21-
${delayEffect(0.4)}
22-
height: 500px;
21+
${delayEffect(0.4)} height: 500px;
2322
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.5);
2423
2524
iframe {
@@ -77,6 +76,7 @@ class ShowcasePreview extends React.PureComponent {
7776
errors={sandbox.errors}
7877
clearErrors={sandboxActions.clearErrors}
7978
preferences={preferences}
79+
dependencies={sandbox.npmDependencies}
8080
noDelay
8181
/>
8282
</Container>

src/app/pages/Sandbox/Editor/Content/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ class EditorPreview extends React.PureComponent {
183183
setProjectView={sandboxActions.setProjectView}
184184
preferences={preferences}
185185
sandboxActions={sandboxActions}
186+
dependencies={sandbox.npmDependencies}
186187
/>
187188
</FullSize>
188189
);

src/embed/components/Content.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ export default class Content extends React.PureComponent {
245245
setFrameHeight={this.handleResize}
246246
initialPath={this.props.initialPath}
247247
errors={errors}
248+
dependencies={sandbox.npmDependencies}
248249
/>
249250
</Split>}
250251
</Container>

src/sandbox/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ async function compile(message) {
7878
if (fetching) return;
7979

8080
handleExternalResources(externalResources);
81-
if (url == null || url !== newUrl) {
81+
if ((url == null || url !== newUrl) && newUrl != null) {
8282
fetching = true;
8383
url = newUrl;
8484
await addDependencyBundle();

0 commit comments

Comments
 (0)