Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Introduce a memory leak to check k6 tests (#5213)
Olga Bulat95fd407a4ed1
diff --git a/frontend/src/stores/ui.ts b/frontend/src/stores/ui.tsindex ec5fefd97..e0a5744e9 100644--- a/frontend/src/stores/ui.ts+++ b/frontend/src/stores/ui.ts@@ -71,20 +71,22 @@ export interface UiState {export const breakpoints = Object.keys(ALL_SCREEN_SIZES)+export const defaultUiState: UiState = {+ instructionsSnackbarState: "not_shown",+ innerFilterVisible: false,+ isFilterDismissed: false,+ isDesktopLayout: false,+ breakpoint: "sm",+ dismissedBanners: [],+ shouldBlurSensitive: true,+ revealedSensitiveResults: [],+ headerHeight: 80,+ colorMode: "system",+ isDarkModeSeen: false,+}+export const useUiStore = defineStore("ui", {- state: (): UiState => ({- instructionsSnackbarState: "not_shown",- innerFilterVisible: false,- isFilterDismissed: false,- isDesktopLayout: false,- breakpoint: "sm",- dismissedBanners: [],- shouldBlurSensitive: true,- revealedSensitiveResults: [],- headerHeight: 80,- colorMode: "system",- isDarkModeSeen: false,- }),+ state: (): UiState => ({ ...defaultUiState }),getters: {cookieState(state): OpenverseCookieState["ui"] {diff --git a/frontend/test/unit/specs/stores/ui-store.spec.ts b/frontend/test/unit/specs/stores/ui-store.spec.tsindex df3baf74b..bfec36471 100644--- a/frontend/test/unit/specs/stores/ui-store.spec.ts+++ b/frontend/test/unit/specs/stores/ui-store.spec.ts@@ -4,7 +4,7 @@ import { vi, describe, beforeEach, it, expect, test } from "vitest"import { setActivePinia, createPinia } from "~~/test/unit/test-utils/pinia"-import { UiState, useUiStore } from "~/stores/ui"+import { defaultUiState, UiState, useUiStore } from "~/stores/ui"import { BannerId } from "~/types/banners"vi.mock("~/types/cookies", async () => {@@ -19,20 +19,7 @@ vi.mock("~/types/cookies", async () => {}})-// Should mirror the "state" property of useUiStore-const initialState: UiState = {- instructionsSnackbarState: "not_shown",- innerFilterVisible: false,- isFilterDismissed: false,- isDesktopLayout: false,- breakpoint: "sm",- dismissedBanners: [],- shouldBlurSensitive: true,- revealedSensitiveResults: [],- headerHeight: 80,- colorMode: "system",- isDarkModeSeen: false,-}+const initialState = defaultUiStateconst VISIBLE_AND_DISMISSED = {innerFilterVisible: true,