diff options
author | dizzy <diosmosis@users.noreply.github.com> | 2022-01-24 14:16:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-24 14:16:10 +0300 |
commit | fc4109e79a79e29a75f0cee582eab1d23cbb9eb3 (patch) | |
tree | f8da88820b50b54d40ccef97e0c043e1bcb61acf /plugins/CoreHome | |
parent | b277655b9163ca0181a67087be6c0dcaea63dc20 (diff) |
do not angularjs watcher in createAngularJsAdapter on first watch execution (#18672)
Diffstat (limited to 'plugins/CoreHome')
-rw-r--r-- | plugins/CoreHome/vue/src/createAngularJsAdapter.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/CoreHome/vue/src/createAngularJsAdapter.ts b/plugins/CoreHome/vue/src/createAngularJsAdapter.ts index e31418133b..d9bd764ea8 100644 --- a/plugins/CoreHome/vue/src/createAngularJsAdapter.ts +++ b/plugins/CoreHome/vue/src/createAngularJsAdapter.ts @@ -250,7 +250,13 @@ export default function createAngularJsAdapter<InjectTypes extends unknown[] = [ return; } - ngScope.$watch(scopeVarName, (newValue: any) => { + ngScope.$watch(scopeVarName, (newValue: any, oldValue: any) => { + if (newValue === oldValue + && JSON.stringify(vm[info.vue!]) === JSON.stringify(newValue) + ) { + return; // initial + } + let newValueFinal = removeAngularJsSpecificProperties(newValue); if (typeof info.default !== 'undefined' && typeof newValue === 'undefined') { newValueFinal = info.default instanceof Function @@ -268,6 +274,7 @@ export default function createAngularJsAdapter<InjectTypes extends unknown[] = [ ...injectedServices, ); } + vm[info.vue!] = newValueFinal; }); }); |