mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-08 06:44:05 -05:00
refactor(frontend): clean up FlowEditor and FormRenderer components
### Changes - Removed console log from `OutputNodeHandle` to reduce clutter. - Cleaned up imports in `FormRenderer` by removing unused `FieldPathList`. - Eliminated the `noValidate` prop in `FormRenderer` for simplification. - Refactored `FieldTemplate` to improve advanced field visibility logic. ### Impact These changes enhance the readability and maintainability of the FlowEditor and FormRenderer components, contributing to a cleaner codebase.
This commit is contained in:
@@ -46,7 +46,6 @@ const OutputNodeHandle = ({
|
||||
const isOutputConnected = useEdgeStore((state) =>
|
||||
state.isOutputConnected(nodeId, field_name),
|
||||
);
|
||||
console.log(field_name, isOutputConnected);
|
||||
return (
|
||||
<Handle
|
||||
type={"source"}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { FieldPathList, RJSFSchema } from "@rjsf/utils";
|
||||
import { RJSFSchema } from "@rjsf/utils";
|
||||
import { preprocessInputSchema } from "./utils/input-schema-pre-processor";
|
||||
import { useMemo } from "react";
|
||||
import { customValidator } from "./utils/custom-validator";
|
||||
@@ -35,7 +35,6 @@ export const FormRenderer2 = ({
|
||||
onChange={handleChange}
|
||||
uiSchema={uiSchema}
|
||||
formData={initialValues}
|
||||
noValidate={true}
|
||||
liveValidate={false}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -40,10 +40,6 @@ export default function FieldTemplate(props: FieldTemplateProps) {
|
||||
const showAdvanced = useNodeStore(
|
||||
(state) => state.nodeAdvancedStates[registry.formContext.nodeId ?? ""],
|
||||
);
|
||||
const isAdvancedField = (schema as any).advanced === true;
|
||||
if (!showAdvanced && isAdvancedField) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (hidden) {
|
||||
return <div className="hidden">{children}</div>;
|
||||
@@ -79,6 +75,10 @@ export default function FieldTemplate(props: FieldTemplateProps) {
|
||||
const shouldShowTitleSection = !isAnyOfSchema(schema) && !additional;
|
||||
const shouldShowChildren = isAnyOfSchema(schema) || !isHandleConnected;
|
||||
|
||||
const isAdvancedField = (schema as any).advanced === true;
|
||||
if (!showAdvanced && isAdvancedField && !isHandleConnected) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<WrapIfAdditionalTemplate
|
||||
classNames={classNames}
|
||||
|
||||
Reference in New Issue
Block a user