Skip to content

feat(form): Add editor to auto form#705

Merged
aXenDeveloper merged 2 commits into
canaryfrom
feat/editor_auto_form
Jul 7, 2026
Merged

feat(form): Add editor to auto form#705
aXenDeveloper merged 2 commits into
canaryfrom
feat/editor_auto_form

Conversation

@aXenDeveloper

Copy link
Copy Markdown
Owner

Improving Documentation

Description

What?

Why?

@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vitnode-docs Ready Ready Preview, Comment Jul 7, 2026 8:13pm

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions github-actions Bot added the 💡 Feature A new feature label Jul 7, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new AutoFormEditor component, integrates it into the auto-form fields, and provides comprehensive documentation, examples, and tests. It also refactors AutoFormRadioGroup and AutoFormSelect to use controlled value props instead of defaultValue to prevent uncontrolled-to-controlled warnings. The feedback highlights a critical issue in the Editor component where the TipTap editor content does not synchronize when the value prop changes dynamically (such as during form resets). To resolve this, it is recommended to import and use a useEffect hook to set the editor content when the value prop updates.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@@ -1,5 +1,7 @@
"use client";

import type React from "react";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Import useEffect from react to allow synchronizing the editor content when the value prop changes dynamically.

Suggested change
import type React from "react";
import React, { useEffect } from "react";

Comment on lines +34 to 37
onUpdate: ({ editor: currentEditor }) => {
onChange?.(currentEditor.getHTML());
},
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

TipTap's useEditor hook only sets the content once during initialization. If the value prop changes from the outside (e.g., when the form is reset or updated programmatically), the editor's content will not update. Adding a useEffect hook ensures the editor content stays in sync with the value prop. Note that we must place this hook before the conditional return if (!editor) return <Loader />; to adhere to the Rules of Hooks.

    onUpdate: ({ editor: currentEditor }) => {
      onChange?.(currentEditor.getHTML());
    },
  });

  useEffect(() => {
    if (editor && !editor.isDestroyed && value !== editor.getHTML()) {
      editor.commands.setContent(value);
    }
  }, [value, editor]);

@aXenDeveloper aXenDeveloper merged commit 5cbe884 into canary Jul 7, 2026
4 checks passed
@aXenDeveloper aXenDeveloper deleted the feat/editor_auto_form branch July 7, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💡 Feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant