From e96626e44d69bb3b5dae60a06865040ecef543fd Mon Sep 17 00:00:00 2001 From: Miroslav Bauer Date: Fri, 10 Nov 2023 09:25:52 +0100 Subject: [PATCH] remove unused imports & format --- .../MultilingualTextInput/MultilingualTextInput.jsx | 3 +-- .../theme/assets/semantic-ui/js/oarepo_ui/forms/hooks.js | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/MultilingualTextInput/MultilingualTextInput.jsx b/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/MultilingualTextInput/MultilingualTextInput.jsx index 49a22e91..7bb552f9 100644 --- a/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/MultilingualTextInput/MultilingualTextInput.jsx +++ b/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/MultilingualTextInput/MultilingualTextInput.jsx @@ -11,7 +11,6 @@ import { } from "@js/oarepo_ui"; import { i18next } from "@translations/oarepo_ui/i18next"; import { useFormikContext, getIn } from "formik"; -import _get from "lodash/get"; export const MultilingualTextInput = ({ fieldPath, @@ -36,7 +35,7 @@ export const MultilingualTextInput = ({ subValuesPath: "lang", }); const value = getIn(values, fieldPath); - const usedLanguages = usedSubValues(value) + const usedLanguages = usedSubValues(value); const newValue = defaultNewValue(emptyNewInput, usedLanguages); return ( diff --git a/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/hooks.js b/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/hooks.js index ab35fe27..6149cb54 100644 --- a/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/hooks.js +++ b/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/hooks.js @@ -1,9 +1,9 @@ import * as React from "react"; import { FormConfigContext } from "./contexts"; import { OARepoDepositApiClient, OARepoDepositSerializer } from "../api"; -import { useFormikContext, getIn } from "formik"; -import _get from "lodash/get" -import _set from "lodash/set" +import { useFormikContext } from "formik"; +import _get from "lodash/get"; +import _set from "lodash/set"; import _omit from "lodash/omit"; import _pick from "lodash/pick"; import _isEmpty from "lodash/isEmpty"; @@ -50,7 +50,7 @@ export const useFormFieldValue = ({ fieldPath, subValuesPath, defaultValue, subV value && typeof Array.isArray(value) ? value.map((val) => _get(val, "lang")) || [] : []; - const defaultNewValue = (initialVal, usedSubValues = []) => _set({...initialVal}, subValuesPath, !usedSubValues?.includes(defaultValue) || !subValuesUnique ? defaultValue : "") + const defaultNewValue = (initialVal, usedSubValues = []) => _set({ ...initialVal }, subValuesPath, !usedSubValues?.includes(defaultValue) || !subValuesUnique ? defaultValue : "") return { usedSubValues, defaultNewValue } }