Skip to content

Commit

Permalink
fix: insert source after from command
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalsaifii committed Feb 8, 2024
1 parent dab78a1 commit f5e0df4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/studio/pages/project/[ref]/logs/explorer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ export const LogsExplorerPage: NextPageWithLayout = () => {
}

const handleInsertSource = (source: LogsTableName) => {
setEditorValue((prev) => prev + source)
setEditorValue((prev) => {
const index = prev.indexOf('from')
if (index === -1) return `${prev}${source}`
return `${prev.substring(0, index + 4)} ${source} ${prev.substring(index + 5)}`
})
setEditorId(uuidv4())
}

Expand Down

0 comments on commit f5e0df4

Please sign in to comment.