Skip to content

Commit

Permalink
Merge pull request #34 from MiracleUFO/chore-snyk/update-dependencies…
Browse files Browse the repository at this point in the history
…-and-license

Chore snyk/update dependencies and license
  • Loading branch information
MiracleUFO authored Dec 2, 2023
2 parents 8967f6c + 8b1d9c7 commit 5dbf0dc
Show file tree
Hide file tree
Showing 7 changed files with 1,621 additions and 375 deletions.
1,967 changes: 1,607 additions & 360 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@miracleufo/react-g-translator",
"version": "1.2.3",
"version": "1.2.4",
"description": "A modern, free, lightweight npm package for translating react apps (component wrapper.) No API keys or language list files are required.",
"author": "Miracle Ufodiama",
"license": "MIT",
Expand Down Expand Up @@ -89,6 +89,7 @@
"jsdom": "20.0.3",
"jsdom-global": "3.0.2",
"prettier": "^3.0.3",
"react-scripts": "^5.0.1",
"rimraf": "^5.0.5",
"rollup": "^3.29.4",
"rollup-plugin-dts": "^6.0.2",
Expand All @@ -109,14 +110,13 @@
},
"dependencies": {
"@rollup/plugin-node-resolve": "^15.2.3",
"@testing-library/jest-dom": "^6.1.3",
"@testing-library/react": "^14.0.0",
"@tanstack/react-query": "^5.12.2",
"@testing-library/jest-dom": "^6.1.5",
"@testing-library/react": "^14.1.2",
"crypto-js": "^4.2.0",
"lodash": "^4.17.21",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^18.2.0",
"react-query": "^3.39.2",
"react-scripts": "5.0.1",
"typescript": "^4.9.5"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Translate.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { QueryClient, QueryClientProvider } from 'react-query';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

import Translation from './helpers/Translation';
import { LanguageProvider } from '../context/languageContext';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Translator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React, {
cloneElement,
isValidElement,
} from 'react';
import { QueryClient, QueryClientProvider } from 'react-query';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

import isVoidElement from '../utils/isVoidElement';
import { LanguageProvider } from '../context/languageContext';
Expand Down
3 changes: 1 addition & 2 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QueryClientConfig } from 'react-query';
import { QueryClientConfig } from '@tanstack/react-query';

import language from '../types/language';

Expand Down Expand Up @@ -30,7 +30,6 @@ const DEFAULT_QUERY_OPTIONS: QueryClientConfig = {
queries: {
retry: 3,
staleTime: ONE_DAY_IN_MS,
cacheTime: ONE_DAY_IN_MS,
},
},
};
Expand Down
10 changes: 5 additions & 5 deletions src/queries/useTranslation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useQuery } from 'react-query';
import { useQuery } from '@tanstack/react-query';
import sha256 from 'crypto-js/sha256';

import { useLanguageContext } from '../context/languageContext';
Expand All @@ -17,10 +17,10 @@ const useTranslation = (
error,
isError,
isLoading,
} = useQuery<string | undefined>(
sha256(`${text}-${from}-${to}`).toString(),
() => getTranslation(text, from || languageFrom, to || languageTo),
);
} = useQuery<string | undefined>({
queryKey: [sha256(`${text}-${from}-${to}`).toString()],
queryFn: () => getTranslation(text, from || languageFrom, to || languageTo),
});

return {
data,
Expand Down
2 changes: 1 addition & 1 deletion src/tests/utils-test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReactElement, ReactNode } from 'react';
import { render, RenderOptions } from '@testing-library/react';
import { QueryClientProvider, QueryClient } from 'react-query';
import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
import { LanguageProvider } from '../context/languageContext';
import { DEFAULT_QUERY_OPTIONS } from './constants-test';

Expand Down

0 comments on commit 5dbf0dc

Please sign in to comment.