From 06960f0dd778b4998eb92b04c642307f6017c5be Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Apr 2024 19:55:52 +0000 Subject: [PATCH] Bump formik from 2.4.5 to 2.4.6 (#8358) * Bump formik from 2.4.5 to 2.4.6 Bumps [formik](https://github.com/jaredpalmer/formik) from 2.4.5 to 2.4.6. - [Release notes](https://github.com/jaredpalmer/formik/releases) - [Commits](https://github.com/jaredpalmer/formik/compare/formik@2.4.5...formik@2.4.6) --- updated-dependencies: - dependency-name: formik dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * mock async icon * use isEqual because formik no longer maintains reference equality on the initialValues object --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ben Loe --- package-lock.json | 8 +++---- package.json | 2 +- src/__mocks__/@/components/asyncIcon.ts | 28 ++++++++++++++++++++++ src/components/form/useFieldAnnotations.ts | 12 ++++------ 4 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 src/__mocks__/@/components/asyncIcon.ts diff --git a/package-lock.json b/package-lock.json index 6ce0bbe78a..d0122e4f4a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,7 +53,7 @@ "filenamify": "^6.0.0", "filter-altered-clicks": "^2.0.1", "fit-textarea": "^3.0.0", - "formik": "^2.4.5", + "formik": "^2.4.6", "fuse.js": "^7.0.0", "generate-schema": "^2.6.0", "handlebars": "^4.7.8", @@ -16458,9 +16458,9 @@ } }, "node_modules/formik": { - "version": "2.4.5", - "resolved": "https://registry.npmjs.org/formik/-/formik-2.4.5.tgz", - "integrity": "sha512-Gxlht0TD3vVdzMDHwkiNZqJ7Mvg77xQNfmBRrNtvzcHZs72TJppSTDKHpImCMJZwcWPBJ8jSQQ95GJzXFf1nAQ==", + "version": "2.4.6", + "resolved": "https://registry.npmjs.org/formik/-/formik-2.4.6.tgz", + "integrity": "sha512-A+2EI7U7aG296q2TLGvNapDNTZp1khVt5Vk0Q/fyfSROss0V/V6+txt2aJnwEos44IxTCW/LYAi/zgWzlevj+g==", "funding": [ { "type": "individual", diff --git a/package.json b/package.json index 0da551a9d5..f06375c0fe 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "filenamify": "^6.0.0", "filter-altered-clicks": "^2.0.1", "fit-textarea": "^3.0.0", - "formik": "^2.4.5", + "formik": "^2.4.6", "fuse.js": "^7.0.0", "generate-schema": "^2.6.0", "handlebars": "^4.7.8", diff --git a/src/__mocks__/@/components/asyncIcon.ts b/src/__mocks__/@/components/asyncIcon.ts new file mode 100644 index 0000000000..9b3e6f6575 --- /dev/null +++ b/src/__mocks__/@/components/asyncIcon.ts @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2024 PixieBrix, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import type { Nullishable } from "@/utils/nullishUtils"; +import type { IconStringDefinition } from "@/types/contract"; +import type { IconProp } from "@fortawesome/fontawesome-svg-core"; + +export function useAsyncIcon( + icon: Nullishable, + defaultIcon: IconProp, + placeholder: IconProp = defaultIcon, +): IconProp { + return defaultIcon; +} diff --git a/src/components/form/useFieldAnnotations.ts b/src/components/form/useFieldAnnotations.ts index 98b9235aa4..432551d7dc 100644 --- a/src/components/form/useFieldAnnotations.ts +++ b/src/components/form/useFieldAnnotations.ts @@ -30,7 +30,7 @@ import { import { type ModComponentFormState } from "@/pageEditor/starterBricks/formStateTypes"; import { type FormikContextType } from "formik"; import { produce } from "immer"; -import { get, isEmpty, set } from "lodash"; +import { get, isEmpty, isEqual, set } from "lodash"; import { AnnotationType } from "@/types/annotationTypes"; import { isNullOrBlank } from "@/utils/stringUtils"; import { type Expression } from "@/types/runtimeTypes"; @@ -98,14 +98,12 @@ function useFieldAnnotations(fieldPath: string): FieldAnnotation[] { return true; } - if ( + const detailValue = typeof annotation.detail === "object" && "expression" in annotation.detail - ) { - return annotation.detail.expression === value; - } - - return annotation.detail === value; + ? annotation.detail.expression + : annotation.detail; + return isEqual(detailValue, value); }) .map(({ message, type, actions }) => { const fieldAnnotation: FieldAnnotation = {