mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 07:04:45 -04:00
Feature/lazy load components (#590)
This commit is contained in:
parent
9c38655a92
commit
101292da92
46 changed files with 261 additions and 248 deletions
|
@ -1,5 +1,5 @@
|
|||
import { DomElement } from 'domhandler'
|
||||
import React, { Fragment, ReactElement } from 'react'
|
||||
import React, { ReactElement, Suspense } from 'react'
|
||||
import { convertNodeToElement, Transform } from 'react-html-parser'
|
||||
import {
|
||||
ComponentReplacer,
|
||||
|
@ -69,7 +69,9 @@ export const buildTransformer = (lineKeys: (LineKeys[] | undefined), allReplacer
|
|||
} else if (tryReplacement === undefined) {
|
||||
return nativeRenderer(node, key)
|
||||
} else {
|
||||
return <Fragment key={key}>{tryReplacement}</Fragment>
|
||||
return <Suspense key={key} fallback={<span>Loading...</span>}>
|
||||
{ tryReplacement }
|
||||
</Suspense>
|
||||
}
|
||||
}
|
||||
return transform
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue