refactor(forms): memoize dynamic form sections with stable ids
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
Add uuid-based section keys and memoized DynamicSection to reduce re-renders, fix dashboard GSAP scoping, update logo sizing, and temporarily hide notice-type and closing-soon widgets. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,8 +8,11 @@ import FileImageUploadCard from "@/components/ui/FileImageUploadCard";
|
||||
import { FormErrorMessages } from "@/constants/Texts";
|
||||
import type { Dispatch, SetStateAction } from "react";
|
||||
import { Controller, type UseFormRegisterReturn } from "react-hook-form";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import type { CreateAdminFormValues } from "./createAdminForm.types";
|
||||
|
||||
const adminSectionId = uuidv4();
|
||||
|
||||
interface CreateAdminFormSectionsOptions {
|
||||
editMode?: boolean;
|
||||
passwordFieldInputType: "password" | "text";
|
||||
@@ -36,6 +39,7 @@ export const createAdminFormSections = ({
|
||||
clearSelectedProfileImage,
|
||||
}: CreateAdminFormSectionsOptions): DynamicFormSection<CreateAdminFormValues>[] => [
|
||||
{
|
||||
id: adminSectionId,
|
||||
title: "Input Fields",
|
||||
fields: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user