Skip to content

Commit 5a259e4

Browse files
author
Ives van Hoorne
committed
Fix external resources not automatically updating
1 parent bedc5c0 commit 5a259e4

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ export default class Preview extends React.PureComponent {
101101
return;
102102
}
103103

104+
if (prevProps.externalResources !== this.props.externalResources) {
105+
// Changed external resources
106+
this.executeCodeImmediately();
107+
return;
108+
}
109+
104110
if (prevProps.module.id !== this.props.module.id) {
105111
if (prevProps.isInProjectView && this.props.isInProjectView) {
106112
// If user only navigated while watching project

src/sandbox/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ async function compile(message) {
5757

5858
if (fetching) return;
5959

60+
handleExternalResources(externalResources);
6061
if (url == null || url !== newUrl) {
6162
fetching = true;
6263
url = newUrl;
63-
handleExternalResources(externalResources);
6464
await addDependencyBundle();
6565
fetching = false;
6666
window.parent.postMessage('Ready!', host);

0 commit comments

Comments
 (0)