Skip to content

Commit b530982

Browse files
fix routing issue
1 parent 50db580 commit b530982

File tree

2 files changed

+42
-17
lines changed

2 files changed

+42
-17
lines changed

client/packages/lowcoder/src/app.tsx

+40-15
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import React from "react";
3535
import { createRoot } from "react-dom/client";
3636
import { Helmet } from "react-helmet";
3737
import { connect, Provider } from "react-redux";
38-
import { Redirect, Router, Switch } from "react-router-dom";
38+
import { Redirect, Route, Router, Switch } from "react-router-dom";
3939
import type { AppState } from "redux/reducers";
4040
import { fetchConfigAction } from "redux/reduxActions/configActions";
4141
import { fetchUserAction } from "redux/reduxActions/userActions";
@@ -311,15 +311,10 @@ class AppIndex extends React.Component<AppIndexProps, any> {
311311
component={LazyPublicAppEditor}
312312
/>
313313

314-
<SimpleSubscriptionContextProvider>
315-
<LazyRoute
316-
fallback="layout"
317-
path={APP_EDITOR_URL}
318-
component={LazyAppEditor}
319-
/>
320-
<LazyRoute
321-
fallback="layout"
322-
path={[
314+
<Route
315+
path={
316+
[
317+
APP_EDITOR_URL,
323318
USER_PROFILE_URL,
324319
NEWS_URL,
325320
ORG_HOME_URL,
@@ -335,11 +330,41 @@ class AppIndex extends React.Component<AppIndexProps, any> {
335330
SETTING_URL,
336331
MARKETPLACE_URL,
337332
ADMIN_APP_URL
338-
]}
339-
// component={ApplicationListPage}
340-
component={LazyApplicationHome}
341-
/>
342-
</SimpleSubscriptionContextProvider>
333+
]
334+
}
335+
>
336+
<SimpleSubscriptionContextProvider>
337+
<Switch>
338+
<LazyRoute
339+
fallback="layout"
340+
path={APP_EDITOR_URL}
341+
component={LazyAppEditor}
342+
/>
343+
<LazyRoute
344+
fallback="layout"
345+
path={[
346+
USER_PROFILE_URL,
347+
NEWS_URL,
348+
ORG_HOME_URL,
349+
ALL_APPLICATIONS_URL,
350+
DATASOURCE_CREATE_URL,
351+
DATASOURCE_EDIT_URL,
352+
DATASOURCE_URL,
353+
SUPPORT_URL,
354+
QUERY_LIBRARY_URL,
355+
FOLDERS_URL,
356+
FOLDER_URL,
357+
TRASH_URL,
358+
SETTING_URL,
359+
MARKETPLACE_URL,
360+
ADMIN_APP_URL
361+
]}
362+
// component={ApplicationListPage}
363+
component={LazyApplicationHome}
364+
/>
365+
</Switch>
366+
</SimpleSubscriptionContextProvider>
367+
</Route>
343368
<LazyRoute exact path={ADMIN_AUTH_URL} component={LazyUserAuthComp} />
344369
<LazyRoute path={USER_AUTH_URL} component={LazyUserAuthComp} />
345370
<LazyRoute

client/packages/lowcoder/src/util/context/SimpleSubscriptionContext.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ export const SimpleSubscriptionContextProvider = (props: {
9595
}
9696
};
9797

98-
if (!productsLoaded && !subscriptionProductsLoading) {
98+
if (!productsLoaded && !subscriptionProductsLoading && !user.isAnonymous) {
9999
console.log("Outer context: Fetching products...");
100100
setSubscriptionProductsLoading(true);
101101
fetchProducts();
102102
}
103-
}, [productsLoaded, subscriptionProductsLoading]);
103+
}, [user.isAnonymous, productsLoaded, subscriptionProductsLoading]);
104104

105105
useEffect(() => {
106106
const initializeCustomer = async () => {

0 commit comments

Comments
 (0)