Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Self Service Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fachschaften der Fakultät für Informatik
Identity Management
Self Service Frontend
Commits
4c3cccd3
Verified
Commit
4c3cccd3
authored
1 year ago
by
Adrian Paschkowski
Browse files
Options
Downloads
Patches
Plain Diff
Lazy-load app routes for code splitting
parent
6b24b7f5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/layout/AppRoutes.tsx
+14
-13
14 additions, 13 deletions
src/components/layout/AppRoutes.tsx
with
14 additions
and
13 deletions
src/components/layout/AppRoutes.tsx
+
14
−
13
View file @
4c3cccd3
import
{
Suspense
}
from
"
react
"
;
import
{
Suspense
,
lazy
}
from
"
react
"
;
import
{
Route
,
Routes
}
from
"
react-router-dom
"
;
import
LoadingPage
from
"
../pages/LoadingPage
"
;
import
IndexPage
from
"
../pages/IndexPage
"
;
import
AccountPage
from
"
../pages/AccountPage
"
;
import
DiscordLinkPage
from
"
../pages/DiscordLinkPage
"
;
import
NotFoundPage
from
"
../pages/NotFoundPage
"
;
import
WidgetsPage
from
"
../pages/WidgetsPage
"
;
import
OAuthCallbackPage
from
"
../pages/OAuthCallbackPage
"
;
import
ContactPage
from
"
../pages/ContactPage
"
;
const
LazyIndexPage
=
lazy
(()
=>
import
(
"
../pages/IndexPage
"
));
const
LazyAccountPage
=
lazy
(()
=>
import
(
"
../pages/AccountPage
"
));
const
LazyDiscordLinkPage
=
lazy
(()
=>
import
(
"
../pages/DiscordLinkPage
"
));
const
LazyContactPage
=
lazy
(()
=>
import
(
"
../pages/ContactPage
"
));
const
LazyOAuthCallbackPage
=
lazy
(()
=>
import
(
"
../pages/OAuthCallbackPage
"
));
const
LazyWidgetsPage
=
lazy
(()
=>
import
(
"
../pages/WidgetsPage
"
));
export
default
function
AppRoutes
()
{
return
(
<
Suspense
fallback
=
{
<
LoadingPage
/>
}
>
<
Routes
>
<
Route
path
=
"/"
element
=
{
<
IndexPage
/>
}
/>
<
Route
path
=
"/account"
element
=
{
<
AccountPage
/>
}
/>
<
Route
path
=
"/discord"
element
=
{
<
DiscordLinkPage
/>
}
/>
<
Route
path
=
"/contact"
element
=
{
<
ContactPage
/>
}
/>
<
Route
path
=
"/auth/:type/callback"
element
=
{
<
OAuthCallbackPage
/>
}
/>
<
Route
path
=
"/"
element
=
{
<
Lazy
IndexPage
/>
}
/>
<
Route
path
=
"/account"
element
=
{
<
Lazy
AccountPage
/>
}
/>
<
Route
path
=
"/discord"
element
=
{
<
Lazy
DiscordLinkPage
/>
}
/>
<
Route
path
=
"/contact"
element
=
{
<
Lazy
ContactPage
/>
}
/>
<
Route
path
=
"/auth/:type/callback"
element
=
{
<
Lazy
OAuthCallbackPage
/>
}
/>
<
Route
path
=
"/debug-loading"
element
=
{
<
LoadingPage
/>
}
/>
<
Route
path
=
"/debug-widgets"
element
=
{
<
WidgetsPage
/>
}
/>
<
Route
path
=
"/debug-widgets"
element
=
{
<
Lazy
WidgetsPage
/>
}
/>
<
Route
path
=
"/*"
element
=
{
<
NotFoundPage
/>
}
/>
</
Routes
>
</
Suspense
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment