Skip to content

Commit

Permalink
chore: perform string type check
Browse files Browse the repository at this point in the history
  • Loading branch information
dcshzj committed Jul 23, 2024
1 parent eb80cf9 commit d05f90f
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export function JsonFormsLinkControl({
label: "Email",
},
]
const dataString = data && typeof data === "string" ? data : ""

return (
<Box py={2}>
Expand All @@ -73,23 +74,23 @@ export function JsonFormsLinkControl({
<TabPanel>
<Input
type="text"
value={data || ""}
value={dataString}
onChange={(e) => handleChange(path, e.target.value)}
placeholder="Page permalink"
/>
</TabPanel>
<TabPanel>
<Input
type="text"
value={data || ""}
value={dataString}
onChange={(e) => handleChange(path, e.target.value)}
placeholder="https://www.isomer.gov.sg"
/>
</TabPanel>
<TabPanel>
<Input
type="text"
value={data || ""}
value={dataString}
onChange={(e) => handleChange(path, e.target.value)}
placeholder="File link"
/>
Expand All @@ -98,8 +99,8 @@ export function JsonFormsLinkControl({
<Input
type="text"
value={
data && data.startsWith("mailto:")
? data.slice("mailto:".length)
dataString.startsWith("mailto:")
? dataString.slice("mailto:".length)
: ""
}
onChange={(e) => handleChange(path, `mailto:${e.target.value}`)}
Expand Down

0 comments on commit d05f90f

Please sign in to comment.