Skip to content

Commit

Permalink
fix merge and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
christinaroise committed Sep 23, 2024
1 parent 3c7e498 commit 51ebdc4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions studio/components/LanguageSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Box, Button, Card, Checkbox, Flex, Text, useTheme } from "@sanity/ui";
import React from "react";
import { PatchEvent, set } from "sanity";

import {
Language,
supportedLanguages,
Expand Down Expand Up @@ -38,7 +39,7 @@ const LanguageSelector = ({ value = [], onChange }: LanguageSelectorProps) => {
const newDefaultLanguage = getNewDefaultLanguage(
updatedValue,
currentDefaultLanguage,
lang
lang,
);

const finalValue = updatedValue.map((item) => ({
Expand Down Expand Up @@ -123,7 +124,7 @@ const LanguageSelector = ({ value = [], onChange }: LanguageSelectorProps) => {
const getNewDefaultLanguage = (
updatedLanguages: Language[],
currentDefault: string | null,
deselectedLang: Language
deselectedLang: Language,
): string | null => {
if (updatedLanguages.length === 1) {
return updatedLanguages[0].id; // Only one language left
Expand All @@ -133,7 +134,7 @@ const getNewDefaultLanguage = (
// Find a new default language if the current default is deselected
return (
supportedLanguages.find((lang) =>
updatedLanguages.some((item) => item.id === lang.id)
updatedLanguages.some((item) => item.id === lang.id),
)?.id || null
);
}
Expand Down

0 comments on commit 51ebdc4

Please sign in to comment.