perform null check on the old value instead of the new one since to follow the non-react version behaviour

GitOrigin-RevId: 33ef74e1b1da41db8a86fc79ae04fbe49ed194df
This commit is contained in:
M Fahru 2023-01-10 08:17:39 -07:00 committed by Copybot
parent 94ab78b427
commit 82cd2d2a77

View file

@ -12,7 +12,8 @@ export default function useSetSpellCheckLanguage() {
return useCallback(
(newSpellCheckLanguage: ProjectSettings['spellCheckLanguage']) => {
const allowUpdate =
newSpellCheckLanguage && newSpellCheckLanguage !== spellCheckLanguage
spellCheckLanguage != null &&
newSpellCheckLanguage !== spellCheckLanguage
if (allowUpdate) {
setSpellCheckLanguage(newSpellCheckLanguage)