fixing flags rerenders
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Antoine M 2024-09-13 10:39:40 +02:00
parent 4186850c0d
commit f4d7d4ad40

View File

@ -39,11 +39,11 @@ export function UserContextProvider({ children }) {
const currentCountry = CountriesJSON.find(
(countryJson) => countryJson.alpha2 === country.iso.toLowerCase()
);
// setCountry({ ...country, label: currentCountry[language.toLowerCase()] });
if (currentCountry && currentCountry[language.toLowerCase()] !== country.label) {
setCountry({ ...country, label: currentCountry[language.toLowerCase()] });
console.log("currentCountry", country);
// eslint-disable-next-line
}, [language]);
}
}, [language, country]);
function changeUserLanguage(newLanguage) {
setLanguage(newLanguage);