|
1 | 1 | import PropTypes from 'prop-types'; |
2 | 2 | import React from 'react'; |
3 | 3 | import '../css/diff-container.css'; |
4 | | -import { |
5 | | - fetchWithTimeout, getUTCDateFormat, getShortUTCDateFormat, jsonResponse |
6 | | -} from '../js/utils.js'; |
| 4 | +import { getUTCDateFormat, getShortUTCDateFormat, jsonResponse } from '../js/utils.js'; |
7 | 5 | import Loading from './loading.jsx'; |
8 | 6 | import isNil from 'lodash/isNil'; |
9 | 7 | import isEmpty from 'lodash/isEmpty'; |
@@ -43,7 +41,6 @@ export default class YmdTimestampHeader extends React.Component { |
43 | 41 | constructor (props) { |
44 | 42 | super(props); |
45 | 43 | const { timestampA, timestampB } = this.props; |
46 | | - this._abortController = new window.AbortController(); |
47 | 44 |
|
48 | 45 | this.timestampSelectLeft = React.createRef(); |
49 | 46 | this.timestampSelectRight = React.createRef(); |
@@ -71,10 +68,6 @@ export default class YmdTimestampHeader extends React.Component { |
71 | 68 | } |
72 | 69 | } |
73 | 70 |
|
74 | | - componentWillUnmount () { |
75 | | - this._abortController.abort(); |
76 | | - } |
77 | | - |
78 | 71 | _handleRightTimestampChange = (event) => { |
79 | 72 | this.setState({ timestampB: event.target.value }); |
80 | 73 | this._updateSnaps('right'); |
@@ -217,7 +210,7 @@ export default class YmdTimestampHeader extends React.Component { |
217 | 210 | requestUrl.searchParams.append('date', year1 + month1); |
218 | 211 | requestUrl.searchParams.append('digest', 1); |
219 | 212 |
|
220 | | - return fetchWithTimeout(requestUrl, { signal: this._abortController.signal }) |
| 213 | + return fetch(requestUrl) |
221 | 214 | .then(jsonResponse) |
222 | 215 | .then(data => data['items']) |
223 | 216 | .then(data => data.map(item => [year1 + month1 + String(item[0]).padStart(8, '0'), item[2]])) |
@@ -300,7 +293,7 @@ export default class YmdTimestampHeader extends React.Component { |
300 | 293 | url.searchParams.append('url', this.props.url); |
301 | 294 | url.searchParams.append('collection', 'web'); |
302 | 295 | url.searchParams.append('output', 'json'); |
303 | | - fetchWithTimeout(url, { signal: this._abortController.signal }) |
| 296 | + fetch(url) |
304 | 297 | .then(jsonResponse) |
305 | 298 | .then((data) => { |
306 | 299 | if (data) { |
|
0 commit comments