Refactor: Update toTitleCase function and CrashErrorComponent (#4940)
* Refactor: Update Data class to handle different types of text inputs The Data class in the langflow schema has been updated to handle different types of text inputs. Previously, the page_content attribute was expected to be a string, but now it can also accept other types. If the input is already a string, it is used as is. Otherwise, it is converted to a string before being assigned to the page_content attribute of the Document object. This change improves the flexibility and robustness of the Data class, allowing it to handle a wider range of input types. * Refactor: Update toTitleCase function to handle ignoreTitleCase option * Refactor: Update CrashErrorComponent to add ignoreTitleCase option to the Report on GitHub button * [autofix.ci] apply automated fixes
This commit is contained in:
parent
a8470c89a2
commit
e14c35ceb5
2 changed files with 4 additions and 2 deletions
|
|
@ -51,7 +51,7 @@ export default function CrashErrorComponent({
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
<Button className="ml-3" variant={"outline"}>
|
<Button className="ml-3" ignoreTitleCase variant={"outline"}>
|
||||||
Report on GitHub
|
Report on GitHub
|
||||||
</Button>
|
</Button>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ export interface ButtonProps
|
||||||
asChild?: boolean;
|
asChild?: boolean;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
unstyled?: boolean;
|
unstyled?: boolean;
|
||||||
|
ignoreTitleCase?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toTitleCase(text: string) {
|
function toTitleCase(text: string) {
|
||||||
|
|
@ -74,6 +75,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
disabled,
|
disabled,
|
||||||
asChild = false,
|
asChild = false,
|
||||||
children,
|
children,
|
||||||
|
ignoreTitleCase = false,
|
||||||
...props
|
...props
|
||||||
},
|
},
|
||||||
ref,
|
ref,
|
||||||
|
|
@ -81,7 +83,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
const Comp = asChild ? Slot : "button";
|
const Comp = asChild ? Slot : "button";
|
||||||
let newChildren = children;
|
let newChildren = children;
|
||||||
if (typeof children === "string") {
|
if (typeof children === "string") {
|
||||||
newChildren = toTitleCase(children);
|
newChildren = ignoreTitleCase ? children : toTitleCase(children);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue