Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions components/dashboard/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
import React, { Suspense, useContext, useEffect, useState } from 'react';
import Menu from './components/Menu';
import { BrowserRouter } from "react-router-dom";
import { Route, Switch } from "react-router";
import { Workspaces } from './workspaces/Workspaces';
import { Redirect, Route, Switch } from "react-router";

import { Login } from './Login';
import { UserContext } from './user-context';
import { getGitpodService } from './service/service';
import { shouldSeeWhatsNew, WhatsNew } from './WhatsNew';
import settingsMenu from './settings/settings-menu';

const Workspaces = React.lazy(() => import(/* webpackPrefetch: true */ './workspaces/Workspaces'));
const Account = React.lazy(() => import(/* webpackPrefetch: true */ './settings/Account'));
const Notifications = React.lazy(() => import(/* webpackPrefetch: true */ './settings/Notifications'));
const Plans = React.lazy(() => import(/* webpackPrefetch: true */ './settings/Plans'));
Expand Down Expand Up @@ -46,7 +46,7 @@ function App() {
}
setLoading(false);
})();
}, []);
}, [ setUser ]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@svenefftinge we need to change this :-(

this effect causes constant stream of getLoggedInUser requests

Screen Shot 2021-04-01 at 05 52 56


if (loading) {
return <Loading />
Expand All @@ -70,14 +70,26 @@ function App() {
<div className="container">
{renderMenu()}
<Switch>
<Route path={["/", "/workspaces"]} exact render={
() => <Workspaces />} />
<Route path={["/account", "/settings"]} exact component={Account} />
<Route path={["/integrations", "/access-control"]} exact component={Integrations} />
<Route path="/workspaces" exact component={Workspaces} />
<Route path="/account" exact component={Account} />
<Route path="/integrations" exact component={Integrations} />
<Route path="/notifications" exact component={Notifications} />
<Route path="/plans" exact component={Plans} />
<Route path="/variables" exact component={EnvironmentVariables} />
<Route path="/preferences" exact component={Preferences} />

<Route path={["/", "/login"]} exact>
<Redirect to="/workspaces"/>
</Route>
<Route path={["/settings"]} exact>
<Redirect to="/account"/>
</Route>
<Route path={["/access-control"]} exact>
<Redirect to="/integrations"/>
</Route>
<Route path={["/subscription", "/usage"]} exact>
<Redirect to="/plans"/>
</Route>
</Switch>
</div>
</Route>;
Expand Down
2 changes: 1 addition & 1 deletion components/dashboard/src/workspaces/Workspaces.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface WorkspacesState {
repos: WhitelistedRepository[];
}

export class Workspaces extends React.Component<WorkspacesProps, WorkspacesState> {
export default class Workspaces extends React.Component<WorkspacesProps, WorkspacesState> {

protected workspaceModel: WorkspaceModel | undefined;

Expand Down