diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000000..2125666142e --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/crowdin.yml b/crowdin.yml index 0ab1a042711..fdcb6bcd32d 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -1,5 +1,6 @@ files: - - source: /src/Locale/en/*.json - translation: /src/Locale/%two_letters_code%/%original_file_name% + - source: /public/locale/{{lang}}.json + translation: /public/locale/%two_letters_code%/%original_file_name% bundles: - 2 + diff --git a/src/Utils/request/request.ts b/src/Utils/request/request.ts index d036ad49750..847b7c9ba60 100644 --- a/src/Utils/request/request.ts +++ b/src/Utils/request/request.ts @@ -70,6 +70,9 @@ export default async function request( return result; } catch (error: any) { result = { error, res: undefined, data: undefined }; + if (error.name === "AbortError") { + return result; + } } } diff --git a/src/Utils/request/useMutation.ts b/src/Utils/request/useMutation.ts index fbc6edc3940..7c368f5e45d 100644 --- a/src/Utils/request/useMutation.ts +++ b/src/Utils/request/useMutation.ts @@ -10,7 +10,7 @@ import { mergeRequestOptions } from "@/Utils/request/utils"; export default function useMutation( route: MutationRoute, - options: RequestOptions, + options: RequestOptions, ) { const [response, setResponse] = React.useState>(); const [isProcessing, setIsProcessing] = React.useState(false); @@ -18,7 +18,7 @@ export default function useMutation( const controllerRef = React.useRef(); const runQuery = React.useCallback( - async (overrides?: RequestOptions) => { + async (overrides?: RequestOptions) => { controllerRef.current?.abort(); const controller = new AbortController(); @@ -31,8 +31,10 @@ export default function useMutation( setIsProcessing(true); const response = await request(route, { ...resolvedOptions, controller }); - setResponse(response); - setIsProcessing(false); + if (response.error?.name !== "AbortError") { + setResponse(response); + setIsProcessing(false); + } return response; }, [route, JSON.stringify(options)], diff --git a/src/Utils/request/useQuery.ts b/src/Utils/request/useQuery.ts index 109ff0bb2f1..5f4c10a289e 100644 --- a/src/Utils/request/useQuery.ts +++ b/src/Utils/request/useQuery.ts @@ -37,8 +37,10 @@ export default function useQuery( setLoading(true); const response = await request(route, { ...resolvedOptions, controller }); - setResponse(response); - setLoading(false); + if (response.error?.name !== "AbortError") { + setResponse(response); + setLoading(false); + } return response; }, [route, JSON.stringify(options)],