fix: Replace "klona/full" -> "klona" in JSONForm to avoid cloning of non-enumerable properties (#13193)

- non-enumerable like `writable`, `configurable`, `enumerable` were getting cloned with `klona/full` and it wasn't needed.
This commit is contained in:
ashit-rath 2022-04-22 14:15:45 +05:30 committed by GitHub
parent 7be912e857
commit 07757c7e7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 11 additions and 19 deletions

View File

@ -1,6 +1,7 @@
import React from "react";
import { isEmpty, isString, maxBy, set, sortBy } from "lodash";
import log from "loglevel";
import { klona } from "klona";
import { isEmpty, isString, maxBy, set, sortBy } from "lodash";
import BaseControl, { ControlProps } from "./BaseControl";
import EmptyDataState from "components/utils/EmptyDataState";
@ -19,8 +20,6 @@ import { StyledPropertyPaneButton } from "./StyledControls";
import { getNextEntityName } from "utils/AppsmithUtils";
import { InputText } from "./InputTextControl";
import { klona } from "klona/full";
type DroppableItem = BaseItemProps & {
index: number;
isCustomField: boolean;

View File

@ -2,13 +2,12 @@ import equal from "fast-deep-equal/es6";
import React, { useEffect, useRef } from "react";
import styled from "styled-components";
import { ControllerProps, useFormContext } from "react-hook-form";
import { klona } from "klona";
import FieldLabel, { FieldLabelProps } from "./FieldLabel";
import useUpdateAccessor from "../fields/useObserveAccessor";
import { FIELD_MARGIN_BOTTOM } from "./styleConstants";
import { klona } from "klona/full";
type FieldProps<TValue> = React.PropsWithChildren<
{
accessor: string;

View File

@ -4,6 +4,7 @@ import styled from "styled-components";
import { debounce, isEmpty } from "lodash";
import { FormProvider, useForm } from "react-hook-form";
import { Text } from "@blueprintjs/core";
import { klona } from "klona";
import useFixedFooter from "./useFixedFooter";
import {
@ -16,8 +17,6 @@ import { ROOT_SCHEMA_KEY, Schema } from "../constants";
import { convertSchemaItemToFormData, schemaItemDefaultValue } from "../helper";
import { TEXT_SIZES } from "constants/WidgetConstants";
import { klona } from "klona/full";
export type FormProps<TValues = any> = PropsWithChildren<{
backgroundColor?: string;
disabledWhenInvalid?: boolean;

View File

@ -9,6 +9,7 @@ import styled from "styled-components";
import { ControllerRenderProps, useFormContext } from "react-hook-form";
import { get, set } from "lodash";
import { Icon } from "@blueprintjs/core";
import { klona } from "klona";
import Accordion from "../component/Accordion";
import FieldLabel from "../component/FieldLabel";
@ -30,8 +31,6 @@ import { FIELD_MARGIN_BOTTOM } from "../component/styleConstants";
import { generateReactKey } from "utils/generators";
import { schemaItemDefaultValue } from "../helper";
import { klona } from "klona/full";
type ArrayComponentProps = FieldComponentBaseProps & {
backgroundColor?: string;
cellBackgroundColor?: string;

View File

@ -2,12 +2,11 @@ import * as Sentry from "@sentry/react";
import { set } from "lodash";
import { ControllerProps, useFormContext } from "react-hook-form";
import { useContext, useEffect } from "react";
import { klona } from "klona";
import FormContext from "../FormContext";
import { FieldType } from "../constants";
import { klona } from "klona/full";
export type UseRegisterFieldValidityProps = {
isValid: boolean;
fieldName: ControllerProps["name"];

View File

@ -1,11 +1,10 @@
import { debounce, set } from "lodash";
import { useMemo, useContext, useCallback } from "react";
import { klona } from "klona";
import { DebouncedExecuteActionPayload } from "widgets/MetaHOC";
import FormContext from "../FormContext";
import { klona } from "klona/full";
export type UseUpdateInternalMetaStateProps = {
propertyName?: string;
};

View File

@ -1,4 +1,5 @@
import { get, set } from "lodash";
import { klona } from "klona";
import SchemaParser, {
applyPositions,
@ -22,8 +23,6 @@ import {
SchemaItem,
} from "./constants";
import { klona } from "klona/full";
const widgetName = "JSONForm1";
describe("#parse", () => {

View File

@ -7,6 +7,8 @@ import {
sortBy,
startCase,
} from "lodash";
import { klona } from "klona";
import { sanitizeKey } from "widgets/WidgetUtils";
import {
ARRAY_ITEM_KEY,
@ -23,8 +25,6 @@ import {
SchemaItem,
} from "./constants";
import { klona } from "klona/full";
type Obj = Record<string, any>;
type JSON = Obj | Obj[];

View File

@ -1,4 +1,5 @@
import { get, set } from "lodash";
import { klona } from "klona";
import schemaTestData from "widgets/JSONFormWidget/schemaTestData";
import {
@ -16,8 +17,6 @@ import {
updateChildrenDisabledStateHook,
} from "./helper";
import { klona } from "klona/full";
const widgetName = "JSONForm1";
describe(".fieldTypeUpdateHook", () => {