Home / File/ form-next-complex-action.ts — ui Source File

form-next-complex-action.ts — ui Source File

Architecture documentation for form-next-complex-action.ts, a typescript file in the ui codebase. 1 imports, 1 dependents.

File typescript ComponentRegistry ChartRegistry 1 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  a48cc779_ad07_39b5_2ccd_6c96646a048d["form-next-complex-action.ts"]
  ae4ed9c2_4beb_f5aa_bc82_ed3428a78bb6["form-next-complex-schema.ts"]
  a48cc779_ad07_39b5_2ccd_6c96646a048d --> ae4ed9c2_4beb_f5aa_bc82_ed3428a78bb6
  2e87948d_2c15_1526_651d_5e33c02cce6e["form-next-complex.tsx"]
  2e87948d_2c15_1526_651d_5e33c02cce6e --> a48cc779_ad07_39b5_2ccd_6c96646a048d
  style a48cc779_ad07_39b5_2ccd_6c96646a048d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use server"

import { formSchema, type FormState } from "./form-next-complex-schema"

export async function complexFormAction(
  _prevState: FormState,
  formData: FormData
) {
  // Sleep for 1 second
  await new Promise((resolve) => setTimeout(resolve, 1000))

  const values = {
    plan: formData.get("plan") as FormState["values"]["plan"],
    billingPeriod: formData.get("billingPeriod") as string,
    addons: formData.getAll("addons") as string[],
    emailNotifications: formData.get("emailNotifications") === "on",
  }

  const result = formSchema.safeParse(values)

  if (!result.success) {
    return {
      values,
      success: false,
      errors: result.error.flatten().fieldErrors,
    }
  }

  // Do something with the values.
  // Call your database or API here.

  return {
    values,
    errors: null,
    success: true,
  }
}

Subdomains

Frequently Asked Questions

What does form-next-complex-action.ts do?
form-next-complex-action.ts is a source file in the ui codebase, written in typescript. It belongs to the ComponentRegistry domain, ChartRegistry subdomain.
What functions are defined in form-next-complex-action.ts?
form-next-complex-action.ts defines 1 function(s): complexFormAction.
What does form-next-complex-action.ts depend on?
form-next-complex-action.ts imports 1 module(s): form-next-complex-schema.ts.
What files import form-next-complex-action.ts?
form-next-complex-action.ts is imported by 1 file(s): form-next-complex.tsx.
Where is form-next-complex-action.ts in the architecture?
form-next-complex-action.ts is located at apps/v4/registry/new-york-v4/examples/form-next-complex-action.ts (domain: ComponentRegistry, subdomain: ChartRegistry, directory: apps/v4/registry/new-york-v4/examples).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free