浏览代码

add check because the button might be unmounted already when trying to call focus()

Artur Paikin 6 年之前
父节点
当前提交
977df35be6
共有 2 个文件被更改,包括 2 次插入0 次删除
  1. 1 0
      src/plugins/Url/UrlUI.js
  2. 1 0
      src/views/ProviderView/AuthView.js

+ 1 - 0
src/plugins/Url/UrlUI.js

@@ -13,6 +13,7 @@ class UrlUI extends Component {
     // Component is mounted right away, but the tab panel might be animating
     // still, so input element is positioned outside viewport. This fixes it.
     setTimeout(() => {
+      if (!this.connectButton) return
       this.input.focus({ preventScroll: true })
     }, 150)
   }

+ 1 - 0
src/views/ProviderView/AuthView.js

@@ -4,6 +4,7 @@ const { h, Component } = require('preact')
 class AuthBlock extends Component {
   componentDidMount () {
     setTimeout(() => {
+      if (!this.connectButton) return
       this.connectButton.focus({ preventScroll: true })
     }, 150)
   }