refactor: Fix dropdownComponent rendering issue and improve tableNodeCellRender value handling
This commit is contained in:
parent
d9eb22b3ab
commit
4527bce31e
3 changed files with 12 additions and 5 deletions
|
|
@ -35,10 +35,9 @@ export default function Dropdown({
|
|||
|
||||
const PopoverContentDropdown =
|
||||
children || editNode ? PopoverContent : PopoverContentWithoutPortal;
|
||||
|
||||
return (
|
||||
<>
|
||||
{Object.keys(options)?.length > 0 ? (
|
||||
{Object.keys(options ?? [])?.length > 0 ? (
|
||||
<>
|
||||
<Popover open={open} onOpenChange={children ? () => {} : setOpen}>
|
||||
{children ? (
|
||||
|
|
|
|||
|
|
@ -131,7 +131,9 @@ export default function TableNodeCellRender({
|
|||
<DictComponent
|
||||
disabled={disabled}
|
||||
editNode={true}
|
||||
value={templateValue.toString() === "{}" ? {} : templateValue}
|
||||
value={
|
||||
(templateValue || "").toString() === "{}" ? {} : templateValue
|
||||
}
|
||||
onChange={(newValue) => {
|
||||
handleOnNewValue(newValue, templateData.key);
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -98,8 +98,14 @@ export default function GenericModal({
|
|||
useEffect(() => {
|
||||
setInputValue(value);
|
||||
}, [value, modalOpen]);
|
||||
const coloredContent = (inputValue || "")
|
||||
?.toString()
|
||||
let coloredContent = inputValue || "";
|
||||
// Check if coloredContent is a string
|
||||
// calling toString on undefined will throw an error
|
||||
// so we need to check if it is a string first
|
||||
if (typeof coloredContent !== "string") {
|
||||
coloredContent = "";
|
||||
}
|
||||
coloredContent
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(regexHighlight, (match, p1, p2) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue