Skip to content

Commit 80cde74

Browse files
committed
fix: refresh config once window.load fires otherwise we get stale data
1 parent 8f67449 commit 80cde74

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/LiveDevelopment/BrowserScripts/RemoteFunctions.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4301,18 +4301,21 @@ function RemoteFunctions(config = {}) {
43014301
_hotCorner = new HotCorner();
43024302
_hotCorner.updateState(config.mode === 'preview');
43034303
}
4304-
_requestConfigRefresh();
43054304
});
43064305
} else {
43074306
// or if the DOM is already ready then init directly
4308-
setTimeout(() => {
4309-
if (!_hotCorner && !isUnitTestWindow) {
4310-
_hotCorner = new HotCorner();
4311-
_hotCorner.updateState(config.mode === 'preview');
4312-
}
4313-
}, 0);
4307+
if (!_hotCorner && !isUnitTestWindow) {
4308+
_hotCorner = new HotCorner();
4309+
_hotCorner.updateState(config.mode === 'preview');
4310+
}
43144311
}
43154312

4313+
// we need to refresh the config once the load is completed
4314+
// this is important because messageBroker gets ready for use only when load fires
4315+
window.addEventListener('load', function() {
4316+
_requestConfigRefresh();
4317+
});
4318+
43164319
let customReturns = {};
43174320
customReturns = { // we have to do this else the minifier will strip the customReturns variable
43184321
...customReturns,

0 commit comments

Comments
 (0)