fix: make requestHistoryStore required in HistoryPlatformDef

This commit is contained in:
Anwarul Islam
2026-06-30 00:03:38 +06:00
parent ef2ac72be6
commit e0591cf42e
3 changed files with 29 additions and 32 deletions
@@ -160,39 +160,39 @@
</template>
<script setup lang="ts">
import IconHelpCircle from "~icons/lucide/help-circle"
import IconTrash2 from "~icons/lucide/trash-2"
import IconTrash from "~icons/lucide/trash"
import IconFilter from "~icons/lucide/filter"
import { computed, ref, Ref, toRaw } from "vue"
import { useColorMode } from "@composables/theming"
import { HoppGQLRequest, HoppRESTRequest } from "@hoppscotch/data"
import { groupBy, escapeRegExp, filter } from "lodash-es"
import { useTimeAgo } from "@vueuse/core"
import { pipe } from "fp-ts/function"
import * as A from "fp-ts/Array"
import { useI18n } from "@composables/i18n"
import { useReadonlyStream } from "@composables/stream"
import { useColorMode } from "@composables/theming"
import { useToast } from "@composables/toast"
import { HoppGQLRequest, HoppRESTRequest } from "@hoppscotch/data"
import { useTimeAgo } from "@vueuse/core"
import * as A from "fp-ts/Array"
import { pipe } from "fp-ts/function"
import { escapeRegExp, filter, groupBy } from "lodash-es"
import { computed, ref, Ref, toRaw } from "vue"
import {
restHistory$,
graphqlHistory$,
clearRESTHistory,
clearGraphqlHistory,
toggleGraphqlHistoryEntryStar,
toggleRESTHistoryEntryStar,
clearRESTHistory,
deleteGraphqlHistoryEntry,
deleteRESTHistoryEntry,
RESTHistoryEntry,
GQLHistoryEntry,
graphqlHistory$,
restHistory$,
RESTHistoryEntry,
toggleGraphqlHistoryEntryStar,
toggleRESTHistoryEntryStar,
} from "~/newstore/history"
import IconFilter from "~icons/lucide/filter"
import IconHelpCircle from "~icons/lucide/help-circle"
import IconTrash from "~icons/lucide/trash"
import IconTrash2 from "~icons/lucide/trash-2"
import HistoryRestCard from "./rest/Card.vue"
import HistoryGraphqlCard from "./graphql/Card.vue"
import { defineActionHandler, invokeAction } from "~/helpers/actions"
import { useService } from "dioc/vue"
import { RESTTabService } from "~/services/tab/rest"
import { defineActionHandler, invokeAction } from "~/helpers/actions"
import { sync } from "~/lib/sync/defs"
import { RESTTabService } from "~/services/tab/rest"
import HistoryGraphqlCard from "./graphql/Card.vue"
import HistoryRestCard from "./rest/Card.vue"
type HistoryEntry = GQLHistoryEntry | RESTHistoryEntry
@@ -218,11 +218,8 @@ const history = useReadonlyStream<RESTHistoryEntry[] | GQLHistoryEntry[]>(
[]
)
const { isHistoryStoreEnabled, isFetchingHistoryStoreStatus } = sync.history
.requestHistoryStore ?? {
isHistoryStoreEnabled: ref(true),
isFetchingHistoryStoreStatus: ref(false),
}
const { isHistoryStoreEnabled, isFetchingHistoryStoreStatus } =
sync.history.requestHistoryStore
const deepCheckForRegex = (value: unknown, regExp: RegExp): boolean => {
if (value === null || value === undefined) return false
@@ -2,7 +2,7 @@ import { Ref } from "vue"
export type HistoryPlatformDef = {
initHistorySync: () => void
requestHistoryStore?: {
requestHistoryStore: {
isHistoryStoreEnabled: Ref<boolean>
isFetchingHistoryStoreStatus: Ref<boolean>
hasErrorFetchingHistoryStoreStatus: Ref<boolean>
@@ -1,13 +1,13 @@
import { TestContainer } from "dioc/testing"
import { beforeEach, describe, expect, it, vi } from "vitest"
import { HistorySpotlightSearcherService } from "../history.searcher"
import { nextTick, ref } from "vue"
import { SpotlightService } from "../.."
import { GQLHistoryEntry, RESTHistoryEntry } from "~/newstore/history"
import { getDefaultRESTRequest } from "~/helpers/rest/default"
import { HoppAction, HoppActionWithArgs } from "~/helpers/actions"
import { getDefaultGQLRequest } from "~/helpers/graphql/default"
import { getDefaultRESTRequest } from "~/helpers/rest/default"
import { GQLHistoryEntry, RESTHistoryEntry } from "~/newstore/history"
import { RESTTabService } from "~/services/tab/rest"
import { SpotlightService } from "../.."
import { HistorySpotlightSearcherService } from "../history.searcher"
async function flushPromises() {
return await new Promise((r) => setTimeout(r))
@@ -56,7 +56,7 @@ vi.mock("~/lib/sync/history", () => ({
__esModule: true,
def: {
initHistorySync: vi.fn(),
requestHistoryStore: undefined,
isHistoryStoreEnabled: false,
},
}))