Skip to content

Commit e2a72d1

Browse files
bartoszherbaMarcin Kwiatkowski
andcommitted
refactor: m2-69. ssr optimization for default layout (#477)
* Test performance improvement commit * chore(deployment): changed deployment config to allow A-B testing on stage * refactor: changed default layout hydration Co-authored-by: Bartosz Herba <[email protected]> Co-authored-by: Marcin Kwiatkowski <[email protected]>
1 parent 28e6171 commit e2a72d1

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,7 @@ module.exports = {
2929
'@vue-storefront/eslint-config-vue',
3030
'@vue-storefront/eslint-config-jest',
3131
],
32+
rules: {
33+
"@typescript-eslint/no-floating-promises": "off"
34+
}
3235
}

packages/composables/src/factories/useStoreFactory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function useStoreFactory<STORES, STORE,
3838
const change = async (store: ComposableFunctionArgs<STORE>): Promise<void> => {
3939
loading.value = true;
4040
try {
41-
await _factoryParams.change(store);
41+
_factoryParams.change(store);
4242
} finally {
4343
loading.value = false;
4444
}

packages/theme/components/CurrencySelector.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export default defineComponent({
104104
105105
const isCurrencyModalOpen = ref(false);
106106
107-
const availableCurrencies = computed(() => currencies.value?.available_currency_codes);
107+
const availableCurrencies = computed(() => currencies.value?.available_currency_codes || []);
108108
109109
return {
110110
currentCurrencySymbol,

packages/theme/composables/useMagentoConfiguration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const useMagentoConfiguration: UseMagentoConfiguration = () => {
4444

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

47-
const loadConfiguration: (params: { updateCookies: boolean; updateLocale: boolean; }) => Promise<void> = async (params = {
47+
const loadConfiguration: (params: { updateCookies: boolean; updateLocale: boolean; }) => void = (params = {
4848
updateCookies: false,
4949
updateLocale: false,
5050
}) => {

packages/theme/layouts/default.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,11 @@ export default defineComponent({
5656
setup() {
5757
const route = useRoute();
5858
const { load: loadUser } = useUser();
59-
6059
const { loadConfiguration } = useMagentoConfiguration();
6160
62-
onSSR(async () => {
63-
await loadConfiguration();
64-
await loadUser();
61+
onMounted(() => {
62+
loadConfiguration();
63+
loadUser();
6564
});
6665
6766
return {

0 commit comments

Comments
 (0)