fix: SSR render error on profile page
parent
a8135197c9
commit
8983edd1bb
|
@ -5,8 +5,11 @@ import { TEXT_NODE, parse, render, walkSync } from 'ultrahtml'
|
||||||
import { findAndReplaceEmojisInText } from '@iconify/utils'
|
import { findAndReplaceEmojisInText } from '@iconify/utils'
|
||||||
import { emojiRegEx, getEmojiAttributes } from '../config/emojis'
|
import { emojiRegEx, getEmojiAttributes } from '../config/emojis'
|
||||||
|
|
||||||
const decoder = process.client ? document.createElement('textarea') : null as any as HTMLTextAreaElement
|
const decoder = process.client ? document.createElement('textarea') : null
|
||||||
export function decodeHtml(text: string) {
|
export function decodeHtml(text: string) {
|
||||||
|
if (!decoder)
|
||||||
|
// not available when SSR
|
||||||
|
return text
|
||||||
decoder.innerHTML = text
|
decoder.innerHTML = text
|
||||||
return decoder.value
|
return decoder.value
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue