mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-12 23:36:00 +00:00
fix(frontend): lazy load components at top level, not inside another component (#265)
* Lazy load components at top level, not inside another component * version --------- Co-authored-by: Anton Tranelis <mail@antontranelis.de>
This commit is contained in:
parent
1828f29cfb
commit
13612c56aa
@ -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'>
|
||||
|
||||
4
lib/package-lock.json
generated
4
lib/package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "utopia-ui",
|
||||
"version": "3.0.105",
|
||||
"version": "3.0.106",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "utopia-ui",
|
||||
"version": "3.0.105",
|
||||
"version": "3.0.106",
|
||||
"license": "GPL-3.0-only",
|
||||
"dependencies": {
|
||||
"@heroicons/react": "^2.0.17",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "utopia-ui",
|
||||
"version": "3.0.105",
|
||||
"version": "3.0.106",
|
||||
"description": "Reuseable React Components to build mapping apps for real life communities and networks",
|
||||
"repository": "https://github.com/utopia-os/utopia-ui",
|
||||
"homepage": "https://utopia-os.org/",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user