File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed
Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -198,7 +198,9 @@ FROM ( SELECT MONTH(committer_when) as month,
198198
199199 loadQuery ( key , sql ) {
200200 const { history } = this . state ;
201- const abortController = new window . AbortController ( ) ;
201+ const abortController = window . AbortController
202+ ? new window . AbortController ( )
203+ : undefined ;
202204
203205 const loadingResults = new Map ( this . state . results ) ;
204206 loadingResults . set ( key , { sql, loading : true , abortController } ) ;
@@ -220,8 +222,9 @@ FROM ( SELECT MONTH(committer_when) as month,
220222 ( ) => this . handleSetActiveResult ( key )
221223 ) ;
222224
225+ const signal = abortController ? abortController . signal : undefined ;
223226 api
224- . query ( sql , abortController . signal )
227+ . query ( sql , signal )
225228 . then ( response => {
226229 this . setResult ( key , { sql, response } ) ;
227230
Original file line number Diff line number Diff line change @@ -210,6 +210,8 @@ class TabbedResults extends Component {
210210 const { codeModalShow, codeModalContent } = this . state ;
211211 const { showUAST, history, languages } = this . props ;
212212
213+ const cancelDisabled = window . AbortController === undefined ;
214+
213215 return (
214216 < div className = "results-padding full-height full-width" >
215217 < DivTabs
@@ -242,6 +244,7 @@ class TabbedResults extends Component {
242244 < Button
243245 className = "animation-action cancel"
244246 bsStyle = "gbpl-tertiary"
247+ disabled = { cancelDisabled }
245248 onClick = { ( ) => this . props . handleAbortQuery ( key ) }
246249 >
247250 CANCEL
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import ReactDOM from 'react-dom' ;
3- import 'abortcontroller-polyfill/dist/polyfill-patch-fetch' ;
43import 'bootstrap/dist/css/bootstrap.css' ;
54import './variables.less' ;
65import App from './App' ;
76
87ReactDOM . render ( < App /> , document . getElementById ( 'root' ) ) ;
8+
9+ if ( ! window . AbortController ) {
10+ // eslint-disable-next-line no-console
11+ console . warn ( `Cancelling gitbase queries is disabled; your browser does not support the AbortController interface.
12+ Please check for compatibility here: https://developer.mozilla.org/en-US/docs/Web/API/AbortController#Browser_compatibility` ) ;
13+ }
You can’t perform that action at this time.
0 commit comments