materialscloud-org / voila-materialscloud-template

The Voila template for Materials Cloud.
Other
2 stars 3 forks source link

Cannot set `innerHTML` #13

Closed CasperWA closed 4 years ago

CasperWA commented 4 years ago

I am seeing some issues when running Voilà using this template stating; TypeError: Cannot set property 'innerHTML' of null . I believe this is due to this template.

The following is an excerpt from index.js, where the issue is found in the script below, specifically when setting innerHTML.

  <script type="text/javascript">
    requirejs(['static/voila'], function(voila) {
      (async function() {
        var kernel = await voila.connectKernel();

        kernel.statusChanged.connect(() => {
          // console.log(kernel.status);
          var el = document.getElementById("kernel-status-icon");

          if (kernel.status == 'busy') {
            el.innerHTML = 'radio_button_checked';
          } else {
            el.innerHTML = 'radio_button_unchecked';
          }
        });
      })();
    });
  </script>
CasperWA commented 4 years ago

Testing this without using this template, the error does indeed not show up.

dou-du commented 4 years ago

You are right. This should be removed. This is not needed in the materialscloud template. It is used in the OSSCAR and Aiidalab template.

CasperWA commented 4 years ago

You are right. This should be removed. This is not needed in the materialscloud template. It is used in the OSSCAR and Aiidalab template.

Why is it used there? Do you have a radio button that changes if the kernel is active or not?