Upgrade axios to fix 'req' undefined error

This commit is contained in:
Chewbacca 2023-01-05 15:24:23 -05:00
parent 26c5214cee
commit 8ec805baad
5 changed files with 10 additions and 9 deletions

View file

@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Datepicker: correctly default to the current year. - Datepicker: correctly default to the current year.
- Scheduled posts: fix page crashing on deleting a scheduled post. - Scheduled posts: fix page crashing on deleting a scheduled post.
- Events: don't crash when searching for a location. - Events: don't crash when searching for a location.
- Search: fixes an abort error when using the navbar search component.
## [3.0.0] - 2022-12-25 ## [3.0.0] - 2022-12-25

View file

@ -6,7 +6,7 @@ import api from '../api';
import { loadCredentials } from './auth'; import { loadCredentials } from './auth';
import { importFetchedAccount } from './importer'; import { importFetchedAccount } from './importer';
import type { AxiosError, AxiosRequestHeaders } from 'axios'; import type { AxiosError, RawAxiosRequestHeaders } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -66,7 +66,7 @@ const patchMe = (params: Record<string, any>, isFormData = false) =>
(dispatch: AppDispatch, getState: () => RootState) => { (dispatch: AppDispatch, getState: () => RootState) => {
dispatch(patchMeRequest()); dispatch(patchMeRequest());
const headers: AxiosRequestHeaders = isFormData ? { const headers: RawAxiosRequestHeaders = isFormData ? {
'Content-Type': 'multipart/form-data', 'Content-Type': 'multipart/form-data',
} : {}; } : {};

View file

@ -44,7 +44,7 @@ const AutosuggestAccountInput: React.FC<IAutosuggestAccountInput> = ({
setAccountIds(ImmutableOrderedSet()); setAccountIds(ImmutableOrderedSet());
}; };
const handleAccountSearch = useCallback(throttle(q => { const handleAccountSearch = useCallback(throttle((q) => {
const params = { q, limit, resolve: false }; const params = { q, limit, resolve: false };
dispatch(accountSearch(params, controller.current.signal)) dispatch(accountSearch(params, controller.current.signal))
@ -53,7 +53,7 @@ const AutosuggestAccountInput: React.FC<IAutosuggestAccountInput> = ({
setAccountIds(ImmutableOrderedSet(accountIds)); setAccountIds(ImmutableOrderedSet(accountIds));
}) })
.catch(noOp); .catch(noOp);
}, 900, { leading: false, trailing: true }), [limit]); }, 900, { leading: true, trailing: true }), [limit]);
const handleChange: React.ChangeEventHandler<HTMLInputElement> = e => { const handleChange: React.ChangeEventHandler<HTMLInputElement> = e => {
refreshCancelToken(); refreshCancelToken();

View file

@ -97,7 +97,7 @@
"@types/webpack-deadcode-plugin": "^0.1.2", "@types/webpack-deadcode-plugin": "^0.1.2",
"array-includes": "^3.1.5", "array-includes": "^3.1.5",
"autoprefixer": "^10.4.2", "autoprefixer": "^10.4.2",
"axios": "^1.0.0-alpha.1", "axios": "^1.2.2",
"axios-mock-adapter": "^1.21.1", "axios-mock-adapter": "^1.21.1",
"babel-loader": "^8.2.5", "babel-loader": "^8.2.5",
"babel-plugin-lodash": "^3.3.4", "babel-plugin-lodash": "^3.3.4",

View file

@ -3658,10 +3658,10 @@ axios-mock-adapter@^1.21.1:
fast-deep-equal "^3.1.3" fast-deep-equal "^3.1.3"
is-buffer "^2.0.5" is-buffer "^2.0.5"
axios@^1.0.0-alpha.1: axios@^1.2.2:
version "1.0.0-alpha.1" version "1.2.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.0.0-alpha.1.tgz#ce69c17ca7605d01787ca754dd906e6fccdf71ee" resolved "https://registry.yarnpkg.com/axios/-/axios-1.2.2.tgz#72681724c6e6a43a9fea860fc558127dbe32f9f1"
integrity sha512-p+meG161943WT+K7sJYquHR46xxi/z0tk7vnSmEf/LrfEAyiP+0uTMMYk1OEo1IRF18oGRhnFxN1y8fLcXaTMw== integrity sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==
dependencies: dependencies:
follow-redirects "^1.15.0" follow-redirects "^1.15.0"
form-data "^4.0.0" form-data "^4.0.0"