mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-09 15:17:59 -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) =>
|
const isOutputConnected = useEdgeStore((state) =>
|
||||||
state.isOutputConnected(nodeId, field_name),
|
state.isOutputConnected(nodeId, field_name),
|
||||||
);
|
);
|
||||||
console.log(field_name, isOutputConnected);
|
|
||||||
return (
|
return (
|
||||||
<Handle
|
<Handle
|
||||||
type={"source"}
|
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 { preprocessInputSchema } from "./utils/input-schema-pre-processor";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { customValidator } from "./utils/custom-validator";
|
import { customValidator } from "./utils/custom-validator";
|
||||||
@@ -35,7 +35,6 @@ export const FormRenderer2 = ({
|
|||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
uiSchema={uiSchema}
|
uiSchema={uiSchema}
|
||||||
formData={initialValues}
|
formData={initialValues}
|
||||||
noValidate={true}
|
|
||||||
liveValidate={false}
|
liveValidate={false}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -40,10 +40,6 @@ export default function FieldTemplate(props: FieldTemplateProps) {
|
|||||||
const showAdvanced = useNodeStore(
|
const showAdvanced = useNodeStore(
|
||||||
(state) => state.nodeAdvancedStates[registry.formContext.nodeId ?? ""],
|
(state) => state.nodeAdvancedStates[registry.formContext.nodeId ?? ""],
|
||||||
);
|
);
|
||||||
const isAdvancedField = (schema as any).advanced === true;
|
|
||||||
if (!showAdvanced && isAdvancedField) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hidden) {
|
if (hidden) {
|
||||||
return <div className="hidden">{children}</div>;
|
return <div className="hidden">{children}</div>;
|
||||||
@@ -79,6 +75,10 @@ export default function FieldTemplate(props: FieldTemplateProps) {
|
|||||||
const shouldShowTitleSection = !isAnyOfSchema(schema) && !additional;
|
const shouldShowTitleSection = !isAnyOfSchema(schema) && !additional;
|
||||||
const shouldShowChildren = isAnyOfSchema(schema) || !isHandleConnected;
|
const shouldShowChildren = isAnyOfSchema(schema) || !isHandleConnected;
|
||||||
|
|
||||||
|
const isAdvancedField = (schema as any).advanced === true;
|
||||||
|
if (!showAdvanced && isAdvancedField && !isHandleConnected) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<WrapIfAdditionalTemplate
|
<WrapIfAdditionalTemplate
|
||||||
classNames={classNames}
|
classNames={classNames}
|
||||||
|
|||||||
Reference in New Issue
Block a user