mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2026-03-01 12:44:17 +00:00
Lazy load components at top level, not inside another component
This commit is contained in:
parent
1828f29cfb
commit
b4c6f27543
@ -51,6 +51,24 @@ import { Landingpage } from './pages/Landingpage'
|
||||
import MapContainer from './pages/MapContainer'
|
||||
import { getBottomRoutes, routes } from './routes/sidebar'
|
||||
|
||||
const ProfileForm = lazy(() =>
|
||||
import('utopia-ui/Profile').then((mod) => ({
|
||||
default: mod.ProfileForm,
|
||||
})),
|
||||
)
|
||||
|
||||
const ProfileView = lazy(() =>
|
||||
import('utopia-ui/Profile').then((mod) => ({
|
||||
default: mod.ProfileView,
|
||||
})),
|
||||
)
|
||||
|
||||
const UserSettings = lazy(() =>
|
||||
import('utopia-ui/Profile').then((mod) => ({
|
||||
default: mod.UserSettings,
|
||||
})),
|
||||
)
|
||||
|
||||
function App() {
|
||||
const [permissionsApiInstance, setPermissionsApiInstance] = useState<permissionsApi>()
|
||||
const [tagsApi, setTagsApi] = useState<itemsApi<Tag>>()
|
||||
@ -134,24 +152,6 @@ function App() {
|
||||
const currentUrl = window.location.href
|
||||
const bottomRoutes = getBottomRoutes(currentUrl)
|
||||
|
||||
const ProfileForm = lazy(() =>
|
||||
import('utopia-ui/Profile').then((mod) => ({
|
||||
default: mod.ProfileForm,
|
||||
})),
|
||||
)
|
||||
|
||||
const ProfileView = lazy(() =>
|
||||
import('utopia-ui/Profile').then((mod) => ({
|
||||
default: mod.ProfileView,
|
||||
})),
|
||||
)
|
||||
|
||||
const UserSettings = lazy(() =>
|
||||
import('utopia-ui/Profile').then((mod) => ({
|
||||
default: mod.UserSettings,
|
||||
})),
|
||||
)
|
||||
|
||||
if (map && layers)
|
||||
return (
|
||||
<div className='App overflow-x-hidden'>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user