Skip to content

Commit

Permalink
fix error message when query is empty (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mistat authored Sep 28, 2024
1 parent b2919be commit 6d576c5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/builder/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,15 @@ const useEditor = () => {
const [editorQuery, setEditorQuery] = useState("");
const [parsedQuery, setParsedQuery] = useState<DocumentNode | null>(null);

const trimComment = (query: string) => {
return query.replace(/#.*\n/g, "").trim();
}

const updatePreview = useMemo(
() =>
R.debounce(
(query: string) => {
query = trimComment(query);
setEditorQuery(query);

try {
Expand Down

0 comments on commit 6d576c5

Please sign in to comment.