Explorar o código

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

Artur Paikin %!s(int64=6) %!d(string=hai) anos
pai
achega
977df35be6
Modificáronse 2 ficheiros con 2 adicións e 0 borrados
  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)
   }