perf(frontend): ノート表示時のMFMパース処理を減らす
This commit is contained in:
parent
bf01c1ee64
commit
d6fe897923
5 changed files with 12 additions and 12 deletions
|
@ -38,6 +38,7 @@ type MfmProps = {
|
|||
emojiUrls?: string[];
|
||||
rootScale?: number;
|
||||
nyaize: boolean | 'account';
|
||||
parsedNodes?: mfm.MfmNode[] | null;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
|
@ -48,7 +49,7 @@ export default function(props: MfmProps) {
|
|||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (props.text == null || props.text === '') return;
|
||||
|
||||
const rootAst = (props.plain ? mfm.parseSimple : mfm.parse)(props.text);
|
||||
const rootAst = props.parsedNodes ?? (props.plain ? mfm.parseSimple : mfm.parse)(props.text);
|
||||
|
||||
const validTime = (t: string | null | undefined) => {
|
||||
if (t == null) return null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue