Skip to content

Commit

Permalink
place empty string when graph name empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Anchel123 committed Feb 4, 2025
1 parent c44c337 commit 941c9f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/components/ui/combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ export default function Combobox({ isSelectGraph = false, disabled = false, inTa
{
options.map((option) => (
<SelectItem
value={option}
key={option}
value={!option ? '""' : option}
key={`key-${option}`}
>
{option}
{!option ? '""' : option}
</SelectItem>
))
}
Expand Down
5 changes: 3 additions & 2 deletions app/graph/Selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ export default function Selector({ onChange, graphName, setGraphName, queries, r
}

const handleOnChange = async (name: string) => {
const formattedName = name === '""' ? "" : name
if (runQuery) {
const q = 'MATCH (n)-[e]-(m) return n,e,m'
const result = await securedFetch(`api/graph/${prepareArg(name)}_schema/?query=${prepareArg(q)}&create=false&role=${session?.user.role}`, {
const result = await securedFetch(`api/graph/${prepareArg(formattedName)}_schema/?query=${prepareArg(q)}&create=false&role=${session?.user.role}`, {
method: "GET"
}, toast)

Expand All @@ -87,7 +88,7 @@ export default function Selector({ onChange, graphName, setGraphName, queries, r
setSchema(Graph.create(name, json.result))
}
}
onChange(name)
onChange(formattedName)
setSelectedValue(name)
}

Expand Down

0 comments on commit 941c9f9

Please sign in to comment.