fix(common): make cursorPosition field optional in HoppGQLDocument type (#4834)

This commit is contained in:
Anwarul Islam 2025-03-05 20:25:07 +06:00 committed by GitHub
parent 6ce0fb8897
commit f3840e4342
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -56,7 +56,7 @@ export type HoppGQLDocument = {
/**
* The cursor position in the document
*/
cursorPosition: number
cursorPosition?: number
/**
* Info about where this request should be saved.

View file

@ -310,7 +310,9 @@ export function useQuery() {
if (!currentTab) return
const currentQuery = currentTab.document.request.query || ""
const selectedOperation = getOperation(currentTab.document.cursorPosition)
const selectedOperation = getOperation(
currentTab.document.cursorPosition || 0
)
const navItems = [...navStack.value, { name: item.name, def: item }]
const result = processOperation(
@ -368,7 +370,7 @@ export function useQuery() {
isArgument = false
): boolean => {
const operation = getOperation(
tabs.currentActiveTab.value?.document.cursorPosition
tabs.currentActiveTab.value?.document.cursorPosition || 0
)
if (!operation) return false