Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit86fc3e0

Browse files
refactor: Better colocate suspense (#4863)
1 parente7dd3f9 commit86fc3e0

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

‎site/src/components/AuthAndFrame/AuthAndFrame.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import{makeStyles}from"@material-ui/core/styles"
22
import{useActor}from"@xstate/react"
3-
import{FC,useContext}from"react"
3+
import{Loader}from"components/Loader/Loader"
4+
import{FC,Suspense,useContext}from"react"
45
import{XServiceContext}from"../../xServices/StateContext"
56
import{Footer}from"../Footer/Footer"
67
import{Navbar}from"../Navbar/Navbar"
@@ -16,14 +17,15 @@ interface AuthAndFrameProps {
1617
exportconstAuthAndFrame:FC<AuthAndFrameProps>=({ children})=>{
1718
conststyles=useStyles()
1819
constxServices=useContext(XServiceContext)
19-
2020
const[buildInfoState]=useActor(xServices.buildInfoXService)
2121

2222
return(
2323
<RequireAuth>
2424
<divclassName={styles.site}>
2525
<Navbar/>
26-
<divclassName={styles.siteContent}>{children}</div>
26+
<divclassName={styles.siteContent}>
27+
<Suspensefallback={<Loader/>}>{children}</Suspense>
28+
</div>
2729
<FooterbuildInfo={buildInfoState.context.buildInfo}/>
2830
</div>
2931
</RequireAuth>

‎site/src/components/DeploySettingsLayout/DeploySettingsLayout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Sidebar } from "./Sidebar"
55
importReact,{
66
createContext,
77
PropsWithChildren,
8+
Suspense,
89
useContext,
910
useEffect,
1011
}from"react"
@@ -52,7 +53,7 @@ export const DeploySettingsLayout: React.FC<PropsWithChildren> = ({
5253
<DeploySettingsContext.Provider
5354
value={{deploymentConfig:deploymentConfig}}
5455
>
55-
{children}
56+
<Suspensefallback={<Loader/>}>{children}</Suspense>
5657
</DeploySettingsContext.Provider>
5758
) :(
5859
<Loader/>

‎site/src/components/TemplateLayout/TemplateLayout.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ import {
1515
PageHeaderTitle,
1616
}from"components/PageHeader/PageHeader"
1717
import{useOrganizationId}from"hooks/useOrganizationId"
18-
import{createContext,FC,PropsWithChildren,useContext}from"react"
18+
import{
19+
createContext,
20+
FC,
21+
PropsWithChildren,
22+
Suspense,
23+
useContext,
24+
}from"react"
1925
import{
2026
LinkasRouterLink,
2127
Navigate,
@@ -33,6 +39,7 @@ import {
3339
import{Margins}from"../../components/Margins/Margins"
3440
import{Stack}from"../../components/Stack/Stack"
3541
import{Permissions}from"xServices/auth/authXService"
42+
import{Loader}from"components/Loader/Loader"
3643

3744
constLanguage={
3845
settingsButton:"Settings",
@@ -224,7 +231,7 @@ export const TemplateLayout: FC<PropsWithChildren> = ({ children }) => {
224231
<TemplateLayoutContext.Provider
225232
value={{ permissions,context:templateState.context}}
226233
>
227-
{children}
234+
<Suspensefallback={<Loader/>}>{children}</Suspense>
228235
</TemplateLayoutContext.Provider>
229236
</Margins>
230237

‎site/src/pages/WorkspacePage/WorkspacePage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { AlertBanner } from "components/AlertBanner/AlertBanner"
44
import{ChooseOne,Cond}from"components/Conditionals/ChooseOne"
55
import{FC,useEffect}from"react"
66
import{useParams}from"react-router-dom"
7-
import{FullScreenLoader}from"components/Loader/FullScreenLoader"
7+
import{Loader}from"components/Loader/Loader"
88
import{firstOrItem}from"util/array"
99
import{workspaceMachine}from"xServices/workspace/workspaceXService"
1010
import{WorkspaceReadyPage}from"./WorkspaceReadyPage"
@@ -55,7 +55,7 @@ export const WorkspacePage: FC = () => {
5555
/>
5656
</Cond>
5757
<Cond>
58-
<FullScreenLoader/>
58+
<Loader/>
5959
</Cond>
6060
</ChooseOne>
6161
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp