File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
app/src/app/pages/Sandbox/Editor/Content/Preview
common/src/components/Preview Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -124,12 +124,12 @@ class Preview extends Component<Props, State> {
124124 handleModuleSyncedChange = ( preview , change ) => {
125125 const settings = this . props . store . preferences . settings ;
126126
127- if ( settings . livePreviewEnabled && change ) {
128- if ( this . props . store . editor . currentSandbox . template === 'static' ) {
129- preview . handleRefresh ( ) ;
130- } else {
131- preview . executeCodeImmediately ( ) ;
132- }
127+ if (
128+ settings . livePreviewEnabled &&
129+ change &&
130+ this . props . store . editor . currentSandbox . template === 'static'
131+ ) {
132+ preview . handleRefresh ( ) ;
133133 }
134134 } ;
135135
Original file line number Diff line number Diff line change @@ -359,6 +359,11 @@ class BasePreview extends React.Component<Props, State> {
359359 } ;
360360
361361 executeCodeImmediately = ( initialRender : boolean = false ) => {
362+ // We cancel the existing calls with executeCode to prevent concurrent calls,
363+ // the only reason we do this is because executeCodeImmediately can be called
364+ // directly as well
365+ // @ts -ignore
366+ this . executeCode . cancel ( ) ;
362367 const settings = this . props . settings ;
363368 const sandbox = this . props . sandbox ;
364369
You can’t perform that action at this time.
0 commit comments