Skip to content

Commit

Permalink
fix: don't fetch emoji on client if server rendered
Browse files Browse the repository at this point in the history
If you employ SSR (Server Side Rendering) in your Nuxt application, the module will inject the emoji `<svg>` or `<img>` element into the output code during your project's build/generate process. Alternatively, if SSR is not used, the emojis will dynamically render during client runtime.
  • Loading branch information
Yizack committed May 21, 2023
1 parent 22bcf16 commit 1355ebc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/runtime/components/Twemoji.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const fetchSVG = () => $fetch(emojiLinkSVG.value).then(async (res) => await res.
const component = computed(() => defineComponent(components.value[parsed.value]))
const loadSVG = async () => {
if (components.value[parsed.value]) return
isFetching.value = true
let svg = await fetchSVG()
isFetching.value = false
Expand Down

0 comments on commit 1355ebc

Please sign in to comment.