mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
fixing condition where entity has been created with empty label
This commit is contained in:
@@ -158,7 +158,7 @@ export class Entity<
|
|||||||
}
|
}
|
||||||
|
|
||||||
get label(): string {
|
get label(): string {
|
||||||
return snakeToPascalWithSpaces(this.config.name ?? this.name);
|
return snakeToPascalWithSpaces(this.config.name || this.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
field(name: string): Field | undefined {
|
field(name: string): Field | undefined {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { typeboxResolver } from "@hookform/resolvers/typebox";
|
import { typeboxResolver } from "@hookform/resolvers/typebox";
|
||||||
import type { Static } from "core/utils";
|
import { type Static, objectCleanEmpty } from "core/utils";
|
||||||
import { type TAppDataEntityFields, entitiesSchema } from "data/data-schema";
|
import { type TAppDataEntityFields, entitiesSchema } from "data/data-schema";
|
||||||
import { mergeWith } from "lodash-es";
|
import { mergeWith } from "lodash-es";
|
||||||
import { useRef } from "react";
|
import { useRef } from "react";
|
||||||
@@ -20,13 +20,15 @@ export function StepEntityFields() {
|
|||||||
const entity = state.entities?.create?.[0]!;
|
const entity = state.entities?.create?.[0]!;
|
||||||
const defaultFields = { id: { type: "primary", name: "id" } } as const;
|
const defaultFields = { id: { type: "primary", name: "id" } } as const;
|
||||||
const ref = useRef<EntityFieldsFormRef>(null);
|
const ref = useRef<EntityFieldsFormRef>(null);
|
||||||
const initial = mergeWith(entity, {
|
const initial = objectCleanEmpty(
|
||||||
|
mergeWith(entity, {
|
||||||
fields: defaultFields,
|
fields: defaultFields,
|
||||||
config: {
|
config: {
|
||||||
sort_field: "id",
|
sort_field: "id",
|
||||||
sort_dir: "asc"
|
sort_dir: "asc"
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
);
|
||||||
const {
|
const {
|
||||||
control,
|
control,
|
||||||
formState: { isValid, errors },
|
formState: { isValid, errors },
|
||||||
|
|||||||
Reference in New Issue
Block a user