Bläddra i källkod

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

Artur Paikin 6 år sedan
förälder
incheckning
977df35be6
2 ändrade filer med 2 tillägg och 0 borttagningar
  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)
   }