mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +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 MapContainer from './pages/MapContainer'
|
||||||
import { getBottomRoutes, routes } from './routes/sidebar'
|
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() {
|
function App() {
|
||||||
const [permissionsApiInstance, setPermissionsApiInstance] = useState<permissionsApi>()
|
const [permissionsApiInstance, setPermissionsApiInstance] = useState<permissionsApi>()
|
||||||
const [tagsApi, setTagsApi] = useState<itemsApi<Tag>>()
|
const [tagsApi, setTagsApi] = useState<itemsApi<Tag>>()
|
||||||
@ -134,24 +152,6 @@ function App() {
|
|||||||
const currentUrl = window.location.href
|
const currentUrl = window.location.href
|
||||||
const bottomRoutes = getBottomRoutes(currentUrl)
|
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)
|
if (map && layers)
|
||||||
return (
|
return (
|
||||||
<div className='App overflow-x-hidden'>
|
<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",
|
"name": "utopia-ui",
|
||||||
"version": "3.0.105",
|
"version": "3.0.106",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "utopia-ui",
|
"name": "utopia-ui",
|
||||||
"version": "3.0.105",
|
"version": "3.0.106",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@heroicons/react": "^2.0.17",
|
"@heroicons/react": "^2.0.17",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "utopia-ui",
|
"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",
|
"description": "Reuseable React Components to build mapping apps for real life communities and networks",
|
||||||
"repository": "https://github.com/utopia-os/utopia-ui",
|
"repository": "https://github.com/utopia-os/utopia-ui",
|
||||||
"homepage": "https://utopia-os.org/",
|
"homepage": "https://utopia-os.org/",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user