Skip to content

Commit

Permalink
feat: use browser lang (#121)
Browse files Browse the repository at this point in the history
* feat: get lang for map

* refactor: use lang

* refactor: use navigator lang

* refactor: remove lang
  • Loading branch information
pyphilia authored May 24, 2024
1 parent 58e711b commit e9badab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const App = (): JSX.Element => {
useSuggestionsForAddress={hooks.useSuggestionsForAddress}
usePostItem={mutations.usePostItem}
useRecycleItems={mutations.useRecycleItems}
lang="fr"
/>
</I18nextProvider>
</ThemeProvider>
Expand Down
4 changes: 3 additions & 1 deletion src/components/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ const Map = ({
useEffect(() => {
if (currentMember) {
i18n.changeLanguage(currentMember.extra.lang ?? DEFAULT_LANG);
} else {
i18n.changeLanguage(navigator.language ?? DEFAULT_LANG);
}
}, [currentMember]);
}, [currentMember, lang]);

Check warning on line 43 in src/components/Map.tsx

View workflow job for this annotation

GitHub Actions / build-and-test

React Hook useEffect has an unnecessary dependency: 'lang'. Either exclude it or remove the dependency array. Outer scope values like 'lang' aren't valid dependencies because mutating them doesn't re-render the component

Check failure on line 43 in src/components/Map.tsx

View workflow job for this annotation

GitHub Actions / build-and-test

'lang' is not defined

return (
<QueryClientContextProvider
Expand Down

0 comments on commit e9badab

Please sign in to comment.