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

Commitb0821a6

Browse files
committed
remove unsed code
1 parent9c709ba commitb0821a6

File tree

4 files changed

+31
-105
lines changed

4 files changed

+31
-105
lines changed

‎viewer/packages/lowcoder/src/app.tsx‎

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,26 @@
11
import{defaultasApp}from"antd/es/app";
22
import{defaultasConfigProvider}from"antd/es/config-provider";
33
import{
4-
ALL_APPLICATIONS_URL,
54
APP_EDITOR_URL,
6-
APPLICATION_VIEW_URL,
7-
BASE_URL,
8-
DATASOURCE_CREATE_URL,
9-
DATASOURCE_EDIT_URL,
10-
DATASOURCE_URL,
11-
QUERY_LIBRARY_URL,
12-
ADMIN_APP_URL,
135
}from"constants/routesURL";
146
importReactfrom"react";
157
import{createRoot}from"react-dom/client";
168
import{Helmet}from"react-helmet";
179
import{connect,Provider}from"react-redux";
18-
import{Redirect,Router,Switch}from"react-router-dom";
10+
import{Router,Switch}from"react-router-dom";
1911
importtype{AppState}from"redux/reducers";
20-
import{fetchConfigAction}from"redux/reduxActions/configActions";
2112
import{fetchUserAction}from"redux/reduxActions/userActions";
2213
import{reduxStore}from"redux/store/store";
23-
import{developEnv}from"util/envUtils";
2414
importhistoryfrom"util/history";
2515
importLazyRoutefrom"components/LazyRoute";
2616
import{getAntdLocale}from"i18n/antdLocale";
2717
import{trans}from"i18n";// language
2818
import{loadComps}from"comps";
2919
import{initApp}from"util/commonUtils";
30-
import{favicon}from"assets/images";
31-
import{hasQueryParam}from"util/urlUtils";
32-
import{isFetchUserFinished}from"redux/selectors/usersSelectors";// getCurrentUser,
33-
import{getIsCommonSettingFetched}from"redux/selectors/commonSettingSelectors";
3420
importGlobalInstancesfrom'components/GlobalInstances';
3521
// import posthog from 'posthog-js'
36-
import{fetchHomeData}from"./redux/reduxActions/applicationActions";
3722

38-
constLazyInviteLanding=React.lazy(()=>import("pages/common/inviteLanding"));
39-
constLazyComponentDoc=React.lazy(()=>import("pages/ComponentDoc"));
40-
constLazyComponentPlayground=React.lazy(()=>import("pages/ComponentPlayground"));
4123
constLazyAppEditor=React.lazy(()=>import("pages/editor/AppEditor"));
42-
constLazyDebugComp=React.lazy(()=>import("./debug"));
43-
constLazyDebugNewComp=React.lazy(()=>import("./debugNew"));
4424

4525
constWrapper=(props:{children:React.ReactNode,language:string})=>(
4626
<ConfigProvider
@@ -74,9 +54,6 @@ class AppIndex extends React.Component<AppIndexProps, any> {
7454
componentDidUpdate(prevProps:AppIndexProps){
7555
}
7656
render(){
77-
constisTemplate=hasQueryParam('template');
78-
constpathname=history.location.pathname;
79-
8057
// we check if we are on the public cloud
8158
constisLowCoderDomain=window.location.hostname==='app.lowcoder.cloud';
8259
constisLocalhost=window.location.hostname==='localhost';
@@ -248,25 +225,6 @@ class AppIndex extends React.Component<AppIndexProps, any> {
248225
path={APP_EDITOR_URL}
249226
component={LazyAppEditor}
250227
/>
251-
<LazyRoute
252-
path={`/playground/:name/:dsl`}
253-
component={LazyComponentPlayground}
254-
/>
255-
{developEnv()&&(
256-
<>
257-
<LazyRoute
258-
path="/debug_comp/:name"
259-
component={LazyDebugComp}
260-
/>
261-
<LazyRoute
262-
exact
263-
path="/debug_comp"
264-
component={LazyDebugComp}
265-
/>
266-
<LazyRoutepath="/debug_editor"component={LazyAppEditor}/>
267-
<LazyRoutepath="/debug_new"component={LazyDebugNewComp}/>
268-
</>
269-
)}
270228
</Switch>
271229
</Router>
272230
</Wrapper>

‎viewer/packages/lowcoder/src/comps/comps/rootComp.tsx‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { ThemeContext } from "comps/utils/themeContext";
1919
import{ModuleLayoutCompName}from"constants/compConstants";
2020
import{defaultThemeaslocalDefaultTheme}from"constants/themeConstants";
2121
import{ModuleLoading}from"components/ModuleLoading";
22-
importEditorSkeletonViewfrom"pages/editor/editorSkeletonView";
2322
import{getGlobalSettings}from"comps/utils/globalSettings";
2423
import{getCurrentTheme}from"comps/utils/themeUtil";
2524
import{DataChangeResponderListComp}from"./dataChangeResponderComp";
@@ -34,6 +33,7 @@ import { ExternalEditorContext } from "util/context/ExternalEditorContext";
3433
import{useUserViewMode}from"util/hooks";
3534
importReactfrom"react";
3635
import{isEqual}from"lodash";
36+
importEditorSkeletonViewfrom"@lowcoder-ee/pages/editor/editorSkeletonView";
3737

3838
constEditorView=lazy(
3939
()=>import("pages/editor/editorView"),
@@ -73,10 +73,10 @@ const RootView = React.memo((props: RootViewProps) => {
7373
previewTheme?.previewTheme||
7474
selectedTheme?.theme||
7575
localDefaultTheme;
76-
76+
7777
constthemeId=selectedTheme ?selectedTheme.id :(
7878
previewTheme ?"preview-theme" :'default-theme-id'
79-
);
79+
);
8080

8181
useEffect(()=>{
8282
constnewEditorState=newEditorState(comp,(changeEditorStateFn)=>{
@@ -123,14 +123,22 @@ const RootView = React.memo((props: RootViewProps) => {
123123
return<ModuleLoading/>;
124124
}
125125

126+
127+
128+
129+
130+
131+
132+
133+
126134
constSuspenseFallback=isModuleRoot ?<ModuleLoading/> :<EditorSkeletonView/>;
127135

128136
if(!editorState){
129137
returnSuspenseFallback;
130138
}
131139

132140
return(
133-
<div{...divProps}style={{height:'100%'}}>
141+
<div{...divProps}style={{height:'100%'}}>
134142
<PropertySectionContext.Providervalue={propertySectionContextValue}>
135143
<ThemeContext.Providervalue={themeContextValue}>
136144
<EditorContext.Providervalue={editorState}>

‎viewer/packages/lowcoder/src/pages/editor/AppEditor.tsx‎

Lines changed: 17 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import{AppPathParams,AppTypeEnum}from"constants/applicationConstants";
2-
import{Suspense,lazy,useCallback,useEffect,useMemo,useRef,useState}from"react";
2+
import{Suspense,lazy,useEffect,useMemo,useRef,useState}from"react";
33
import{useDispatch,useSelector}from"react-redux";
44
import{useParams}from"react-router";
55
import{AppSummaryInfo,fetchApplicationInfo}from"redux/reduxActions/applicationActions";
6-
import{fetchDataSourceByApp,fetchDataSourceTypes}from"redux/reduxActions/datasourceActions";
76
import{getUser}from"redux/selectors/usersSelectors";
8-
import{useUserViewMode}from"util/hooks";
97
import"comps/uiCompRegistry";
10-
import{showAppSnapshotSelector}from"redux/selectors/appSnapshotSelector";
118
import{setShowAppSnapshot}from"redux/reduxActions/appSnapshotActions";
129
import{fetchGroupsAction}from"redux/reduxActions/orgActions";
1310
import{getFetchOrgGroupsFinished}from"redux/selectors/orgSelectors";
@@ -20,34 +17,24 @@ import {
2017
perfMark,
2118
}from"util/perfUtils";
2219
import{useMount,useUnmount}from"react-use";
23-
import{fetchQueryLibraryDropdown}from"../../redux/reduxActions/queryLibraryActions";
2420
import{clearGlobalSettings,setGlobalSettings}from"comps/utils/globalSettings";
25-
import{fetchFolderElements}from"redux/reduxActions/folderActions";
2621
import{registryDataSourcePlugin}from"constants/queryConstants";
2722
import{DatasourceApi}from"api/datasourceApi";
2823
import{useRootCompInstance}from"./useRootCompInstance";
2924
importEditorSkeletonViewfrom"./editorSkeletonView";
30-
import{ErrorBoundary,FallbackProps}from'react-error-boundary';
25+
import{ErrorBoundary}from'react-error-boundary';
3126
import{ALL_APPLICATIONS_URL}from"@lowcoder-ee/constants/routesURL";
3227
importhistoryfrom"util/history";
3328
importFlexfrom"antd/es/flex";
3429
importReactfrom"react";
3530

36-
constAppSnapshot=lazy(()=>{
37-
returnimport("pages/editor/appSnapshot")
38-
.then(moduleExports=>({default:moduleExports.AppSnapshot}));
39-
});
40-
4131
constAppEditorInternalView=lazy(
4232
()=>import("pages/editor/appEditorInternal")
43-
.then(moduleExports=>({default:moduleExports.AppEditorInternalView}))
33+
.then(moduleExports=>({default:moduleExports.AppEditorInternalView}))
4434
);
4535

4636
constAppEditor=React.memo(()=>{
47-
constshowAppSnapshot=useSelector(showAppSnapshotSelector);
4837
constparams=useParams<AppPathParams>();
49-
constisUserViewModeCheck=useUserViewMode();
50-
constisUserViewMode=params.viewMode ?isUserViewModeCheck :true;
5138
constapplicationId=params.applicationId||window.location.pathname.split("/")[2];
5239
constparamViewMode=params.viewMode||window.location.pathname.split("/")[3];
5340
constviewMode=(paramViewMode==="view"||paramViewMode==="admin") ?"published" :paramViewMode==="view_marketplace" ?"view_marketplace" :"editing";
@@ -82,25 +69,8 @@ const AppEditor = React.memo(() => {
8269
appType:AppTypeEnum.Application,
8370
});
8471

85-
constreadOnly=isUserViewMode;
86-
constcompInstance=useRootCompInstance(appInfo,readOnly,isDataSourcePluginRegistered);
72+
constcompInstance=useRootCompInstance(appInfo,true,isDataSourcePluginRegistered);
8773

88-
// fetch dataSource and plugin
89-
useEffect(()=>{
90-
if(!orgId||paramViewMode!=="edit"){
91-
return;
92-
}
93-
dispatch(fetchDataSourceTypes({organizationId:orgId}));
94-
dispatch(fetchFolderElements({}));
95-
},[dispatch,orgId,paramViewMode]);
96-
97-
useEffect(()=>{
98-
if(applicationId&&paramViewMode==="edit"){
99-
dispatch(fetchDataSourceByApp({applicationId:applicationId}));
100-
dispatch(fetchQueryLibraryDropdown());
101-
}
102-
},[dispatch,applicationId,paramViewMode]);
103-
10474
constfetchJSDataSourceByApp=()=>{
10575
DatasourceApi.fetchJsDatasourceByApp(applicationId).then((res)=>{
10676
res.data.data.forEach((i)=>{
@@ -148,8 +118,8 @@ const AppEditor = React.memo(() => {
148118
width:'400px',
149119
margin:'0 auto',
150120
}}>
151-
<h4style={{margin:0}}>Something went wrong while displaying this webpage</h4>
152-
<buttononClick={()=>history.push(ALL_APPLICATIONS_URL)}style={{background:'#4965f2',border:'1px solid #4965f2',color:'#ffffff',borderRadius:'6px'}}>Go to Apps</button>
121+
<h4style={{margin:0}}>Something went wrong while displaying this webpage</h4>
122+
<buttononClick={()=>history.push(ALL_APPLICATIONS_URL)}style={{background:'#4965f2',border:'1px solid #4965f2',color:'#ffffff',borderRadius:'6px'}}>Go to Apps</button>
153123
</Flex>
154124
),[]);
155125

@@ -161,34 +131,23 @@ const AppEditor = React.memo(() => {
161131
margin:'0 auto',
162132
}}>
163133
<h4>{appError}</h4>
164-
<buttononClick={()=>history.push(ALL_APPLICATIONS_URL)}style={{background:'#4965f2',border:'1px solid #4965f2',color:'#ffffff',borderRadius:'6px'}}>Back to Home</button>
134+
<buttononClick={()=>history.push(ALL_APPLICATIONS_URL)}style={{background:'#4965f2',border:'1px solid #4965f2',color:'#ffffff',borderRadius:'6px'}}>Back to Home</button>
165135
</Flex>
166136
)
167137
}
168138

169139
return(
170140
<ErrorBoundaryfallback={fallbackUI}>
171-
{showAppSnapshot ?(
172-
<Suspensefallback={<EditorSkeletonView/>}>
173-
<AppSnapshot
174-
currentAppInfo={{
175-
...appInfo,
176-
dsl:compInstance.comp?.toJsonValue()||{},
177-
}}
178-
/>
179-
</Suspense>
180-
) :(
181-
<Suspensefallback={<EditorSkeletonView/>}>
182-
<AppEditorInternalView
183-
appInfo={appInfo}
184-
readOnly={readOnly}
185-
loading={
186-
!fetchOrgGroupsFinished||!isDataSourcePluginRegistered||isCommonSettingsFetching
187-
}
188-
compInstance={compInstance}
189-
/>
190-
</Suspense>
191-
)}
141+
<Suspensefallback={<EditorSkeletonView/>}>
142+
<AppEditorInternalView
143+
appInfo={appInfo}
144+
readOnly={false}
145+
loading={
146+
!fetchOrgGroupsFinished||!isDataSourcePluginRegistered||isCommonSettingsFetching
147+
}
148+
compInstance={compInstance}
149+
/>
150+
</Suspense>
192151
</ErrorBoundary>
193152
);
194153
});

‎viewer/packages/lowcoder/src/pages/editor/appEditorInternal.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ interface AppEditorInternalViewProps {
1515

1616
exportconstAppEditorInternalView=React.memo((props:AppEditorInternalViewProps)=>{
1717
const{ compInstance}=props;
18+
console.log("+++++++++++++++++++++++++++++++++++++++",props)
1819

1920
useEffect(()=>{
2021
message.config({top:0});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp