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:
Max 2025-06-23 09:08:49 +02:00 committed by GitHub
parent 1828f29cfb
commit 13612c56aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 21 deletions

View File

@ -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
View File

@ -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",

View File

@ -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/",