Skip to content

Commit

Permalink
fix i18n watcher and window global (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
huseyindeniz authored Oct 1, 2023
1 parent 2094b7e commit a99117a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
}
}
</style>
<script>
window.global = window;
</script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vitedapp",
"private": true,
"version": "0.3.0",
"version": "0.3.1",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 0 additions & 2 deletions src/features/i18n/components/LangMenu/LangMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { useLocation } from 'react-router-dom';

import { i18nConfig } from '../../config';
import { useChangeLanguage } from '../../useChangeLanguage';
import { useI18nWatcher } from '../../useI18nWatchers';

const LangModal = React.lazy(() =>
import(/* webpackChunkName: "LangModal" */ './LangModal').then(module => ({
Expand All @@ -17,7 +16,6 @@ const LangModal = React.lazy(() =>
export const LangMenu: React.FC = () => {
const location = useLocation();
const { i18n } = useTranslation('Layout');
useI18nWatcher();
const { changeLanguage } = useChangeLanguage(
location.pathname,
i18n.resolvedLanguage ?? i18nConfig.fallbackLang.code
Expand Down
2 changes: 1 addition & 1 deletion src/features/ui/components/Layout/Copyright/Copyright.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import reactDappTemplateLogo from '../../../assets/images/react-dapp-template-lo
export const Copyright: React.FC = React.memo(() => {
return (
<Box>
<Tooltip label="Powered by React dApp Template (Vite) v0.3.0">
<Tooltip label="Powered by React dApp Template (Vite) v0.3.1">
<Button
as={Link}
href="https://github.com/huseyindeniz/vite-react-dapp-template"
Expand Down
2 changes: 2 additions & 0 deletions src/features/ui/components/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { HelmetProvider } from 'react-helmet-async';
import { useTranslation } from 'react-i18next';
import { useLocation, Outlet } from 'react-router-dom';

import { useI18nWatcher } from '@/features/i18n/useI18nWatchers';
import { usePageLink } from '@/pages/usePageLink';
import { usePages } from '@/pages/usePages';

Expand All @@ -29,6 +30,7 @@ const myErrorHandler = (error: Error, info: { componentStack: string }) => {
export const Layout: React.FC = () => {
const location = useLocation();
const { t } = useTranslation('Layout');
useI18nWatcher();
const { pageLink } = usePageLink();
const { mainMenuItems, secondaryMenuItems } = usePages();
const siteName = t('SITE_NAME');
Expand Down

0 comments on commit a99117a

Please sign in to comment.