瀏覽代碼

[ui] Knockout wrongly mounts invisible components (#3330)

Knockout wrongly mounts components inside <!-- ko if: condition --> <!-- /ko --> when condition is false. Investigation revealed that it can be solved using templates.
Sreenath Somarajapuram 2 年之前
父節點
當前提交
bb45a00047
共有 1 個文件被更改,包括 9 次插入6 次删除
  1. 9 6
      apps/jobbrowser/src/jobbrowser/templates/job_browser.mako

+ 9 - 6
apps/jobbrowser/src/jobbrowser/templates/job_browser.mako

@@ -486,13 +486,9 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
               <!-- /ko -->
               <div id="slas" data-bind="visible: interface() === 'slas'"></div>
 
-              <!-- ko if: interface() === 'hive-queries' -->
-                <queries-list></queries-list>
-              <!-- /ko -->
+              <div data-bind="template: { name: 'hive-queries-template', if: interface() === 'hive-queries' }"></div>
 
-              <!-- ko if: interface() === 'impala-queries' -->
-                <impala-queries></impala-queries>
-              <!-- /ko -->
+              <div data-bind="template: { name: 'impala-queries-template', if: interface() === 'impala-queries' }"></div>
 
               <!-- ko if: interface() === 'oozie-info' -->
                 <!-- ko hueSpinner: { spin: oozieInfoLoading(), center: true, size: 'xlarge' } --><!-- /ko -->
@@ -596,6 +592,13 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
   <!-- /ko -->
 </div>
 
+<script type="text/html" id="hive-queries-template">
+  <queries-list></queries-list>
+</script>
+
+<script type="text/html" id="impala-queries-template">
+  <impala-queries></impala-queries>
+</script>
 
 <script type="text/html" id="breadcrumbs-icons${ SUFFIX }">
 <!-- ko switch: type -->