From 8983edd1bbc4331ae01c8eb6f7ec0485ba968128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Wed, 4 Jan 2023 17:26:31 +0800 Subject: [PATCH] fix: SSR render error on profile page --- composables/content-parse.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composables/content-parse.ts b/composables/content-parse.ts index ae2213da2..92211e90c 100644 --- a/composables/content-parse.ts +++ b/composables/content-parse.ts @@ -5,8 +5,11 @@ import { TEXT_NODE, parse, render, walkSync } from 'ultrahtml' import { findAndReplaceEmojisInText } from '@iconify/utils' 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) { + if (!decoder) + // not available when SSR + return text decoder.innerHTML = text return decoder.value }