refactor: minor performance improvements on teams related operations
This commit is contained in:
@@ -25,8 +25,7 @@ import {
|
||||
HoppGQLRequest,
|
||||
HoppRESTRequest,
|
||||
} from "@hoppscotch/data"
|
||||
import { hoppWorkspaceStore } from "~/newstore/workspace"
|
||||
import { changeWorkspace } from "~/newstore/workspace"
|
||||
import { WorkspaceService } from "~/services/workspace.service"
|
||||
import { invokeAction } from "~/helpers/actions"
|
||||
|
||||
/**
|
||||
@@ -46,6 +45,7 @@ export class CollectionsSpotlightSearcherService
|
||||
public searcherSectionTitle = this.t("collection.my_collections")
|
||||
|
||||
private readonly spotlight = this.bind(SpotlightService)
|
||||
private readonly workspaceService = this.bind(WorkspaceService)
|
||||
|
||||
constructor() {
|
||||
super()
|
||||
@@ -284,8 +284,8 @@ export class CollectionsSpotlightSearcherService
|
||||
const folderPath = path.split("/").map((x) => parseInt(x))
|
||||
const reqIndex = folderPath.pop()!
|
||||
|
||||
if (hoppWorkspaceStore.value.workspace.type !== "personal") {
|
||||
changeWorkspace({
|
||||
if (this.workspaceService.currentWorkspace.value.type !== "personal") {
|
||||
this.workspaceService.changeWorkspace({
|
||||
type: "personal",
|
||||
})
|
||||
}
|
||||
|
||||
@@ -25,16 +25,15 @@ import { Service } from "dioc"
|
||||
import * as E from "fp-ts/Either"
|
||||
import MiniSearch from "minisearch"
|
||||
import IconCheckCircle from "~/components/app/spotlight/entry/IconSelected.vue"
|
||||
import { useStreamStatic } from "~/composables/stream"
|
||||
import { runGQLQuery } from "~/helpers/backend/GQLClient"
|
||||
import { GetMyTeamsDocument, GetMyTeamsQuery } from "~/helpers/backend/graphql"
|
||||
import { workspaceStatus$ } from "~/newstore/workspace"
|
||||
import { platform } from "~/platform"
|
||||
import IconEdit from "~icons/lucide/edit"
|
||||
import IconTrash2 from "~icons/lucide/trash-2"
|
||||
import IconUser from "~icons/lucide/user"
|
||||
import IconUserPlus from "~icons/lucide/user-plus"
|
||||
import IconUsers from "~icons/lucide/users"
|
||||
import { WorkspaceService } from "~/services/workspace.service"
|
||||
|
||||
type Doc = {
|
||||
text: string | string[]
|
||||
@@ -58,14 +57,9 @@ export class WorkspaceSpotlightSearcherService extends StaticSpotlightSearcherSe
|
||||
public searcherSectionTitle = this.t("spotlight.workspace.title")
|
||||
|
||||
private readonly spotlight = this.bind(SpotlightService)
|
||||
private readonly workspaceService = this.bind(WorkspaceService)
|
||||
|
||||
private workspace = useStreamStatic(
|
||||
workspaceStatus$,
|
||||
{ type: "personal" },
|
||||
() => {
|
||||
/* noop */
|
||||
}
|
||||
)[0]
|
||||
private workspace = this.workspaceService.currentWorkspace
|
||||
|
||||
private isTeamSelected = computed(
|
||||
() =>
|
||||
@@ -170,6 +164,7 @@ export class SwitchWorkspaceSpotlightSearcherService
|
||||
public searcherSectionTitle = this.t("workspace.title")
|
||||
|
||||
private readonly spotlight = this.bind(SpotlightService)
|
||||
private readonly workspaceService = this.bind(WorkspaceService)
|
||||
|
||||
constructor() {
|
||||
super()
|
||||
@@ -197,13 +192,7 @@ export class SwitchWorkspaceSpotlightSearcherService
|
||||
})
|
||||
}
|
||||
|
||||
private workspace = useStreamStatic(
|
||||
workspaceStatus$,
|
||||
{ type: "personal" },
|
||||
() => {
|
||||
/* noop */
|
||||
}
|
||||
)[0]
|
||||
private workspace = this.workspaceService.currentWorkspace
|
||||
|
||||
createSearchSession(
|
||||
query: Readonly<Ref<string>>
|
||||
|
||||
Reference in New Issue
Block a user