Commit c12d7ddd authored by AUTOMATIC's avatar AUTOMATIC
Browse files

add handling to some places in javascript that can potentially cause issues #6898

parent 79d802b4
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -93,10 +93,12 @@ function checkBrackets(evt) {
}
}


var shadowRootLoaded = setInterval(function() {
var shadowRootLoaded = setInterval(function() {
  var shadowTextArea = document.querySelector('gradio-app').shadowRoot.querySelectorAll('#txt2img_prompt > label > textarea');
  var sahdowRoot = document.querySelector('gradio-app').shadowRoot;
  if(shadowTextArea.length < 1) {
  if(! sahdowRoot)  return false;
      return false;

  }
  var shadowTextArea = sahdowRoot.querySelectorAll('#txt2img_prompt > label > textarea');
  if(shadowTextArea.length < 1)  return false;



  clearInterval(shadowRootLoaded);
  clearInterval(shadowRootLoaded);


+7 −2
Original line number Original line Diff line number Diff line
@@ -81,8 +81,13 @@ function request(url, data, handler, errorHandler){
    xhr.onreadystatechange = function () {
    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4) {
        if (xhr.readyState === 4) {
            if (xhr.status === 200) {
            if (xhr.status === 200) {
                try {
                    var js = JSON.parse(xhr.responseText);
                    var js = JSON.parse(xhr.responseText);
                    handler(js)
                    handler(js)
                } catch (error) {
                    console.error(error);
                    errorHandler()
                }
            } else{
            } else{
                errorHandler()
                errorHandler()
            }
            }