Skip to content

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

Document global ref SSR safety (#848)

sarayourfriend87a291fa38c1
diff --git a/src/composables/use-active-audio.js b/src/composables/use-active-audio.js
index 24f66726f..2d52ee375 100644
--- a/src/composables/use-active-audio.js
+++ b/src/composables/use-active-audio.js
@@ -1,6 +1,11 @@
import { ref } from '@nuxtjs/composition-api'
-/** @type {import('@nuxtjs/composition-api').Ref<HTMLAudioElement | undefined>} */
+/**
+ * This global ref is SSR safe because it will only
+ * change internal value based on client side interaction.
+ *
+ * @type {import('@nuxtjs/composition-api').Ref<HTMLAudioElement | undefined>}
+ */
const obj = ref(undefined)
export function useActiveAudio() {
diff --git a/src/composables/use-filter-sidebar-visibility.js b/src/composables/use-filter-sidebar-visibility.js
index 02f3eb6e1..22caa6331 100644
--- a/src/composables/use-filter-sidebar-visibility.js
+++ b/src/composables/use-filter-sidebar-visibility.js
@@ -2,7 +2,12 @@ import { onMounted, ref } from '@nuxtjs/composition-api'
import local from '~/utils/local'
import { isMinScreen } from '~/composables/use-media-query'
-/** @type {import('@nuxtjs/composition-api').Ref<boolean>} */
+/**
+ * This global ref is SSR safe because it will only
+ * change internal value based on client side interaction.
+ *
+ * @type {import('@nuxtjs/composition-api').Ref<boolean>}
+ */
const isVisible = ref(false)
/**
diff --git a/src/composables/use-window-scroll.js b/src/composables/use-window-scroll.js
index 1cb4ecfc5..f131b1452 100644
--- a/src/composables/use-window-scroll.js
+++ b/src/composables/use-window-scroll.js
@@ -5,7 +5,10 @@ import { ref } from '@nuxtjs/composition-api'
import { useEventListener } from '~/composables/use-event-listener'
/**
- * Whether the page has been scrolled down at all
+ * Whether the page has been scrolled down at all.
+ *
+ * This global ref is SSR safe because it will only
+ * change internal value based on client side interaction.
*
* @type {import('@nuxtjs/composition-api').Ref<boolean>}
*/