Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Fix frontend memory leak (#4864)

zacka5d966d23299
diff --git a/frontend/src/stores/ui.ts b/frontend/src/stores/ui.ts
index ba3f5aa9d..4144d799d 100644
--- a/frontend/src/stores/ui.ts
+++ b/frontend/src/stores/ui.ts
@@ -69,21 +69,19 @@ 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",
-}
-
export const useUiStore = defineStore("ui", {
- state: (): UiState => ({ ...defaultUiState }),
+ state: (): UiState => ({
+ instructionsSnackbarState: "not_shown",
+ innerFilterVisible: false,
+ isFilterDismissed: false,
+ isDesktopLayout: false,
+ breakpoint: "sm",
+ dismissedBanners: [],
+ shouldBlurSensitive: true,
+ revealedSensitiveResults: [],
+ headerHeight: 80,
+ colorMode: "system",
+ }),
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.ts
index bfec36471..5eff88432 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 { defaultUiState, UiState, useUiStore } from "~/stores/ui"
+import { UiState, useUiStore } from "~/stores/ui"
import { BannerId } from "~/types/banners"
vi.mock("~/types/cookies", async () => {
@@ -19,7 +19,19 @@ vi.mock("~/types/cookies", async () => {
}
})
-const initialState = defaultUiState
+// 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",
+}
const VISIBLE_AND_DISMISSED = {
innerFilterVisible: true,
diff --git a/utilities/load_testing/Dockerfile b/utilities/load_testing/Dockerfile
index c959e56d0..633e9b246 100644
--- a/utilities/load_testing/Dockerfile
+++ b/utilities/load_testing/Dockerfile
@@ -4,7 +4,7 @@
# K6 #
######
-FROM docker.io/grafana/k6:v0.51.0 AS k6
+FROM docker.io/grafana/k6:0.51.0 AS k6
###############
# Observation #