Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ module.exports = {
'@vue-storefront/eslint-config-vue',
'@vue-storefront/eslint-config-jest',
],
rules: {
"@typescript-eslint/no-floating-promises": "off"
}
}
2 changes: 1 addition & 1 deletion packages/composables/src/factories/useStoreFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function useStoreFactory<STORES, STORE,
const change = async (store: ComposableFunctionArgs<STORE>): Promise<void> => {
loading.value = true;
try {
await _factoryParams.change(store);
_factoryParams.change(store);
} finally {
loading.value = false;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/components/CurrencySelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default defineComponent({

const isCurrencyModalOpen = ref(false);

const availableCurrencies = computed(() => currencies.value?.available_currency_codes);
const availableCurrencies = computed(() => currencies.value?.available_currency_codes || []);

return {
currentCurrencySymbol,
Expand Down
10 changes: 4 additions & 6 deletions packages/theme/composables/useMagentoConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,17 @@ export const useMagentoConfiguration: UseMagentoConfiguration = () => {

const selectedStore = computed<string | undefined>(() => app.$cookies.get(cookieNames.storeCookieName));

const loadConfiguration: (params: { updateCookies: boolean; updateLocale: boolean; }) => Promise<void> = async (params = {
const loadConfiguration: (params: { updateCookies: boolean; updateLocale: boolean; }) => void = (params = {
updateCookies: false,
updateLocale: false,
}) => {
const {
updateCookies,
updateLocale,
} = params;
await Promise.all([
loadConfig(),
loadStores(),
loadCurrencies(),
]);
loadConfig();
loadStores();
loadCurrencies();

if (!app.$cookies.get(cookieNames.storeCookieName) || updateCookies) {
app.$cookies.set(cookieNames.storeCookieName, storeConfigGetters.getCode(storeConfig.value));
Expand Down
28 changes: 19 additions & 9 deletions packages/theme/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,38 @@
<TopBar class="desktop-only" />
</LazyHydrate>

<AppHeader />
<LazyHydrate when-visible>
<AppHeader />
</LazyHydrate>

<div id="layout">
<nuxt :key="route.fullPath" />
</div>

<LazyHydrate on-interaction>
<BottomNavigation />
</LazyHydrate>
<LazyHydrate when-idle>
<CartSidebar />
</LazyHydrate>
<LazyHydrate when-idle>
<WishlistSidebar />
</LazyHydrate>
<LazyHydrate when-visible>
<LoginModal />
</LazyHydrate>
<LazyHydrate when-idle>
<Notification />
</div>
<LazyHydrate when-visible>
</LazyHydrate>
<LazyHydrate on-interaction>
<AppFooter />
</LazyHydrate>
</div>
</template>

<script>
import LazyHydrate from 'vue-lazy-hydration';
import { onSSR } from '@vue-storefront/core';
import { useRoute, defineComponent } from '@nuxtjs/composition-api';
import { useRoute, defineComponent, onMounted } from '@nuxtjs/composition-api';
import {
useUser,
} from '@vue-storefront/magento';
Expand Down Expand Up @@ -56,12 +67,11 @@ export default defineComponent({
setup() {
const route = useRoute();
const { load: loadUser } = useUser();

const { loadConfiguration } = useMagentoConfiguration();

onSSR(async () => {
await loadConfiguration();
await loadUser();
onMounted(() => {
loadConfiguration();
loadUser();
});

return {
Expand Down