From d1f71508fe008c827cecc770beb506856370d30f Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 12 Sep 2022 22:31:05 +0200 Subject: [PATCH] Drop Knockout.js loading components asynchronous https://knockoutjs.com/documentation/component-registration.html#controlling-synchronousasynchronous-loading --- .../knockout/build/fragments/source-references.js | 2 +- vendors/knockout/src/components/loaderRegistry.js | 14 +++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/vendors/knockout/build/fragments/source-references.js b/vendors/knockout/build/fragments/source-references.js index 581940cf6..1229585af 100644 --- a/vendors/knockout/build/fragments/source-references.js +++ b/vendors/knockout/build/fragments/source-references.js @@ -8,7 +8,7 @@ knockoutDebugCallback([ 'src/utils.domNodeDisposal.js', // 'src/utils.domManipulation.js', // 'src/memoization.js', - 'src/tasks.js', +// 'src/tasks.js', 'src/subscribables/extenders.js', 'src/subscribables/subscribable.js', 'src/subscribables/dependencyDetection.js', diff --git a/vendors/knockout/src/components/loaderRegistry.js b/vendors/knockout/src/components/loaderRegistry.js index 07b383146..0d94fbd4b 100644 --- a/vendors/knockout/src/components/loaderRegistry.js +++ b/vendors/knockout/src/components/loaderRegistry.js @@ -5,11 +5,10 @@ ko.components = { get: (componentName, callback) => { if (loadedDefinitionsCache.has(componentName)) { - ko.tasks.schedule(() => callback(loadedDefinitionsCache.get(componentName))); + callback(loadedDefinitionsCache.get(componentName)); } else { // Join the loading process that is already underway, or start a new one. - var subscribable = loadingSubscribablesCache[componentName], - completedAsync; + var subscribable = loadingSubscribablesCache[componentName]; if (subscribable) { subscribable.subscribe(callback); } else { @@ -27,15 +26,8 @@ // // You can bypass the 'always asynchronous' feature by putting the synchronous:true // flag on your component configuration when you register it. - if (completedAsync) { - // Note that notifySubscribers ignores any dependencies read within the callback. - // See comment in loaderRegistryBehaviors.js for reasoning - subscribable.notifySubscribers(definition); - } else { - ko.tasks.schedule(() => subscribable.notifySubscribers(definition)); - } + subscribable.notifySubscribers(definition); }); - completedAsync = true; } } },