[Neue] Parallel font loading on web (#5411)

* Parallel font loading

(cherry picked from commit 10e2b05b575bbbf8b0ca5b4a336817cd902d712b)

* Handle failures

* Rely on font-face and preload tags for font loading (#5431)

* Cache fonts for a year
This commit is contained in:
Eric Bailey
2024-09-19 17:57:15 -05:00
committed by GitHub
parent c8184e823d
commit 22410a3cee
19 changed files with 216 additions and 15 deletions
+2 -3
View File
@@ -46,7 +46,7 @@ import {Provider as VideoVolumeProvider} from '#/view/com/util/post-embeds/Video
import * as Toast from '#/view/com/util/Toast'
import {ToastContainer} from '#/view/com/util/Toast.web'
import {Shell} from '#/view/shell/index'
import {ThemeProvider as Alf, useFonts} from '#/alf'
import {ThemeProvider as Alf} from '#/alf'
import {useColorModeTheme} from '#/alf/util/useColorModeTheme'
import {NuxDialogs} from '#/components/dialogs/nuxs'
import {useStarterPackEntry} from '#/components/hooks/useStarterPackEntry'
@@ -146,13 +146,12 @@ function InnerApp() {
function App() {
const [isReady, setReady] = useState(false)
const [loaded, error] = useFonts()
React.useEffect(() => {
initPersistedState().then(() => setReady(true))
}, [])
if (!isReady || (!loaded && !error)) {
if (!isReady) {
return null
}