diff --git a/packages/hoppscotch-common/src/components/collections/Collection.vue b/packages/hoppscotch-common/src/components/collections/Collection.vue index b7245673..f3ff9f4f 100644 --- a/packages/hoppscotch-common/src/components/collections/Collection.vue +++ b/packages/hoppscotch-common/src/components/collections/Collection.vue @@ -473,7 +473,8 @@ const mockServerStatus = computed(() => { const collectionId = props.collectionsType === "my-collections" - ? (props.data as HoppCollection).id + ? ((props.data as HoppCollection).id ?? + (props.data as HoppCollection)._ref_id) : (props.data as TeamCollection).id return getMockServerStatus(collectionId || "") diff --git a/packages/hoppscotch-common/src/components/collections/index.vue b/packages/hoppscotch-common/src/components/collections/index.vue index 93080b36..4390a417 100644 --- a/packages/hoppscotch-common/src/components/collections/index.vue +++ b/packages/hoppscotch-common/src/components/collections/index.vue @@ -1083,7 +1083,7 @@ const createMockServer = (payload: { }) => { // Import the mock server store dynamically to avoid circular dependencies import("~/newstore/mockServers").then(({ showCreateMockServerModal$ }) => { - let collectionID = payload.collection.id ?? undefined + let collectionID = payload.collection.id ?? payload.collection._ref_id // If this is a child collection (folder), we need to get the root collection ID if (payload.collectionIndex.includes("/")) { @@ -1091,7 +1091,7 @@ const createMockServer = (payload: { const rootIndex = payload.collectionIndex.split("/")[0] const rootCollection = myCollections.value[parseInt(rootIndex)] if (rootCollection) { - collectionID = rootCollection.id ?? undefined + collectionID = rootCollection.id ?? rootCollection._ref_id } } diff --git a/packages/hoppscotch-common/src/components/mockServer/CreateMockServer.vue b/packages/hoppscotch-common/src/components/mockServer/CreateMockServer.vue index 345c1ecd..032d2b56 100644 --- a/packages/hoppscotch-common/src/components/mockServer/CreateMockServer.vue +++ b/packages/hoppscotch-common/src/components/mockServer/CreateMockServer.vue @@ -386,7 +386,10 @@ const isExistingMockServer = computed(() => !!existingMockServer.value) // Collection options for the selector (only root collections) const collectionOptions = computed(() => { return availableCollections.value.map((collection) => { - const collectionId = collection.id + const collectionId = + currentWorkspace.value.type === "team" + ? collection.id + : (collection.id ?? collection._ref_id) // TODO: fix this fallback logic for personal workspaces in the future const hasMockServer = mockServers.value.some( (server) => server.collectionID === collectionId ) diff --git a/packages/hoppscotch-common/src/composables/mockServerVisibility.ts b/packages/hoppscotch-common/src/composables/mockServerVisibility.ts index 02a83512..63d53ff5 100644 --- a/packages/hoppscotch-common/src/composables/mockServerVisibility.ts +++ b/packages/hoppscotch-common/src/composables/mockServerVisibility.ts @@ -1,43 +1,21 @@ import { computed } from "vue" + import { useSetting } from "~/composables/settings" -import { platform } from "~/platform" -import { useService } from "dioc/vue" -import { WorkspaceService } from "~/services/workspace.service" /** - * Composable to determine mock server visibility based on experimental flags and platform configuration + * Composable to determine mock server visibility based on experimental flags */ export function useMockServerVisibility() { const ENABLE_EXPERIMENTAL_MOCK_SERVERS = useSetting( "ENABLE_EXPERIMENTAL_MOCK_SERVERS" ) - const workspaceService = useService(WorkspaceService) - /** - * Check if mock servers should be visible based on experimental flag and platform configuration + * Check if mock servers should be visible based on experimental flag */ - const isMockServerVisible = computed(() => { - // First check if experimental mock servers are enabled - if (!ENABLE_EXPERIMENTAL_MOCK_SERVERS.value) { - return false - } - - // Check if platform disables mock servers in personal workspaces - const disableInPersonalWorkspace = - platform.platformFeatureFlags.disableMockServerInPersonalWorkspace ?? - false - - // If platform disables mock servers in personal workspaces and current workspace is personal, hide mock servers - if ( - disableInPersonalWorkspace && - workspaceService.currentWorkspace.value.type === "personal" - ) { - return false - } - - return true - }) + const isMockServerVisible = computed( + () => ENABLE_EXPERIMENTAL_MOCK_SERVERS.value + ) return { isMockServerVisible, diff --git a/packages/hoppscotch-common/src/platform/index.ts b/packages/hoppscotch-common/src/platform/index.ts index 5aec2f81..cec460c4 100644 --- a/packages/hoppscotch-common/src/platform/index.ts +++ b/packages/hoppscotch-common/src/platform/index.ts @@ -66,12 +66,6 @@ export type PlatformDef = { * Whether to show the A/B testing workspace switcher click login flow or not */ workspaceSwitcherLogin?: Ref - - /** - * Whether to disable mock servers in personal workspaces - * If a value is not given, then the value is assumed to be false - */ - disableMockServerInPersonalWorkspace?: boolean } limits?: LimitsPlatformDef infra?: InfraPlatformDef