From fca8437b113ca94d40b2fb0b79ff684267d027d2 Mon Sep 17 00:00:00 2001 From: Samson Akol Date: Fri, 30 Sep 2022 15:57:07 +0300 Subject: [PATCH] Fixes bugs in composable --- lib/KResponsiveWindow.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/KResponsiveWindow.js b/lib/KResponsiveWindow.js index b5dfb2c09..147d47ec1 100644 --- a/lib/KResponsiveWindow.js +++ b/lib/KResponsiveWindow.js @@ -1,4 +1,4 @@ -import { computed, onBeforeUnmount, onMounted, ref, watchEffect } from '@vue/composition-api'; +import { computed, onBeforeUnmount, onMounted, ref, watchEffect } from 'vue'; function windowMetrics() { return { @@ -7,10 +7,6 @@ function windowMetrics() { }; } -function isNuxtServerSideRendering() { - return process && process.server; -} - function addMediaQuery(query, callback) { const mediaQueryList = window.matchMedia(query); const eventHandler = event => { @@ -29,11 +25,7 @@ function addMediaQuery(query, callback) { }; } -if (!isNuxtServerSideRendering()) { - //Do nothing for now. Remove after testing -} - -export default function KResponsiveWindow() { +export default function useResponsiveWindow() { const windowWidth = ref(null); const windowHeight = ref(null); const windowBreakpoint = ref(null); @@ -102,7 +94,7 @@ export default function KResponsiveWindow() { }); const _updateGutter = () => { - if (windowIsSmall) { + if (windowIsSmall.value) { windowGutter.value = 16; } else if (_smallestWindowDimensionIsLessThan(600)) { windowGutter.value = 16;