Skip to content

Commit 8cc28bb

Browse files
authored
fix: solved reactivity problem in currencyFormat provide (#725)
1 parent 9296ba1 commit 8cc28bb

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ const isTeleportViewMode = computed(() =>
127127
)
128128
129129
const currencyFormat = computed(() => currencies[snippetConfig.currency!])
130-
provide<string>('currencyFormat', currencyFormat.value)
130+
provide('currencyFormat', currencyFormat)
131131
132132
const queriesPreviewInfo = computed(() => snippetConfig.queriesPreview ?? [])
133133
provide<ComputedRef<QueryPreviewInfo[]> | undefined>('queriesPreviewInfo', queriesPreviewInfo)

src/components/results/result.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,14 @@
5656
<span class="x-text2 x-text-lead-50">{{ result.brand }}</span>
5757
</template>
5858
<div class="x-flex x-flex-wrap x-gap-8">
59-
<BaseResultCurrentPrice :result="result" class="x-text2 x-text2-lg x-font-bold" />
59+
<BaseResultCurrentPrice
60+
:result="result"
61+
:format="currencyFormat"
62+
class="x-text2 x-text2-lg x-font-bold"
63+
/>
6064
<BaseResultPreviousPrice
6165
:result="result"
66+
:format="currencyFormat"
6267
class="x-text2 x-leading-[1.7] x-text-neutral-75 x-line-through"
6368
/>
6469
</div>
@@ -70,6 +75,7 @@
7075
<script setup lang="ts">
7176
import type { SnippetConfig } from '@empathyco/x-components'
7277
import type { Result } from '@empathyco/x-types'
78+
import type { ComputedRef } from 'vue'
7379
import {
7480
BaseEventButton,
7581
BaseFallbackImage,
@@ -97,6 +103,8 @@ const props = withDefaults(defineProps<Props>(), {
97103
showAddToCart: true,
98104
})
99105
106+
const currencyFormat = inject<ComputedRef<string>>('currencyFormat')!
107+
100108
const events = { UserClickedResultWithVariants: props.result }
101109
const onWishlistClickEvents = { UserClickedResultWishlist: props.result }
102110

0 commit comments

Comments
 (0)