Skip to content

Commit 952917b

Browse files
authored
Fix/wrong display of skeleton loaders (#156)
* only show skeleton loaders when actually navigatin and not when clicking already active category * improve variant selection styling * optimize dependencies in dev mode for better DX * revert vite depOptimization entry * increase version
1 parent 859db29 commit 952917b

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

components/Cms/Element/CmsElementCategoryNavigation.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const listingStore = useListingStore(route.path === '/search' ? 'search' : 'cate
2626
:to="getCategoryRoute(item)"
2727
class="text-lg"
2828
:class="{ 'font-bold': isActive(item.seoUrls) }"
29-
@click="listingStore.isLoading = true;"
29+
@click="listingStore.isLoading = !isActive(item.seoUrls, true);"
3030
>
3131
{{ getTranslatedProperty(item, 'name') }}
3232
</LocaleLink>
@@ -40,7 +40,7 @@ const listingStore = useListingStore(route.path === '/search' ? 'search' : 'cate
4040
<LocaleLink
4141
:to="getCategoryRoute(child)"
4242
:class="{ 'font-bold': isActive(child.seoUrls) }"
43-
@click="listingStore.isLoading = true;"
43+
@click="listingStore.isLoading = !isActive(child.seoUrls, true);"
4444
>
4545
{{ getTranslatedProperty(child, 'name') }}
4646
</LocaleLink>

components/Navigation/NavigationLink.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const listingStore = useListingStore(route.path === '/search' ? 'search' : 'cate
5959
:format="!isExternalLink"
6060
class="block transition-all hover:text-brand-primary"
6161
:class="[classes, isActive(navigationElement.seoUrls, activeWithExactMatch) ? activeClasses : '']"
62-
@click="trackNavigation(navigationElement.level ? navigationElement.level - 1 : 0, getTranslatedProperty(navigationElement, 'name')); listingStore.isLoading = true;"
62+
@click="trackNavigation(navigationElement.level ? navigationElement.level - 1 : 0, getTranslatedProperty(navigationElement, 'name')); listingStore.isLoading = !isActive(navigationElement.seoUrls, true);"
6363
>
6464
<template v-if="asAllItemsLink">
6565
{{ $t('navigation.sidebar.allItems') }}

components/Product/ProductVariantSelection.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,8 @@ const onVariantChange = async (groupName: string, optionId: string) => {
8787
outer: {
8888
'max-w-full min-w-32 w-full sm:w-fit': true,
8989
},
90-
inner: {
91-
'pr-4': true,
92-
},
9390
input: {
94-
'w-fit': true,
91+
'w-fit mr-2 text-ellipsis': true,
9592
},
9693
}"
9794
:options="entityArrayToOptions<Schemas['PropertyGroupOption']>(group.options.sort((a: Schemas['PropertyGroupOption'], b: Schemas['PropertyGroupOption']) => (a.position ?? 999) - (b.position ?? 999)), 'name', false) ?? []"

composables/useActivePath.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ import { useRoute } from 'vue-router';
22
import type { Schemas } from '@shopware/api-client/api-types';
33

44
export const useActivePath = () => {
5+
// useRoute needs to be called here and not inside the function to prevent loss of context when calling the function outside the initial rendering process
6+
const route = useRoute();
7+
58
const isActive = (path: Schemas['SeoUrl'][] | undefined, onlyExactMatch: boolean = false) => {
69
if (!path) return false;
710

811
const formattedPath = `/${path[0]?.seoPathInfo}`;
9-
const { path: currentPath } = useRoute();
12+
const currentPath = route.path;
1013

1114
return onlyExactMatch ? formattedPath === currentPath : currentPath.includes(formattedPath);
1215
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@basecom-gmbh/pond",
33
"type": "module",
44
"main": "./nuxt.config.ts",
5-
"version": "0.1.8",
5+
"version": "0.1.9",
66
"scripts": {
77
"build": "nuxt build",
88
"dev": "nuxt dev",

0 commit comments

Comments
 (0)