Skip to content

Commit

Permalink
[WEB-1404] chore: space app infinite loader and scroll fix. (#4559)
Browse files Browse the repository at this point in the history
* [WEB-1404] chore: space app infinite loader and scroll fix.

* chore: revert back `isLoading` initail state to `true` in user store.
  • Loading branch information
prateekshourya29 committed May 23, 2024
1 parent c9e6ead commit 780caf5
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 25 deletions.
20 changes: 0 additions & 20 deletions space/app/loading.tsx

This file was deleted.

7 changes: 5 additions & 2 deletions space/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
"use client";

import { observer } from "mobx-react-lite";
// components
import { UserLoggedIn } from "@/components/account";
import { LogoSpinner } from "@/components/common";
import { AuthView } from "@/components/views";
// hooks
import { useUser } from "@/hooks/store";

export default function HomePage() {
const HomePage = observer(() => {
const { data: currentUser, isAuthenticated, isLoading } = useUser();

if (isLoading) return <LogoSpinner />;

if (currentUser && isAuthenticated) return <UserLoggedIn />;

return <AuthView />;
}
});

export default HomePage;
2 changes: 1 addition & 1 deletion space/components/views/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const AuthView = observer(() => {
</Link>
</div>
</div>
<div className="flex-grow container mx-auto max-w-lg px-10 lg:max-w-md lg:px-5 py-10 lg:pt-28 transition-all">
<div className="flex flex-col justify-center flex-grow container h-[100vh-60px] mx-auto max-w-lg px-10 lg:max-w-md lg:px-5 transition-all">
<AuthRoot />
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion space/helpers/authentication.helper.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ReactNode } from "react";
import Link from "next/link";
// helpers
import { SUPPORT_EMAIL } from "./common.helper";

export enum EPageTypes {
INIT = "INIT",
Expand Down Expand Up @@ -152,7 +154,7 @@ const errorCodeMessages: {
// sign in
[EAuthenticationErrorCodes.USER_ACCOUNT_DEACTIVATED]: {
title: `User account deactivated`,
message: () => <div>Your account is deactivated. Contact support@plane.so.</div>,
message: () => `User account deactivated. Please contact ${!!SUPPORT_EMAIL ? SUPPORT_EMAIL : "administrator"}.`,
},

[EAuthenticationErrorCodes.USER_DOES_NOT_EXIST]: {
Expand Down
2 changes: 2 additions & 0 deletions space/helpers/common.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export const ADMIN_BASE_PATH = process.env.NEXT_PUBLIC_ADMIN_BASE_PATH || "";

export const SPACE_BASE_PATH = process.env.NEXT_PUBLIC_SPACE_BASE_PATH || "";

export const SUPPORT_EMAIL = process.env.NEXT_PUBLIC_SUPPORT_EMAIL || "";

export const WEB_BASE_URL = process.env.NEXT_PUBLIC_WEB_BASE_URL || "";

export const GOD_MODE_URL = encodeURI(`${ADMIN_BASE_URL}${ADMIN_BASE_PATH}`);
Expand Down
6 changes: 5 additions & 1 deletion space/lib/instance-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ export const InstanceProvider = observer(({ children }: { children: ReactNode })
revalidateIfStale: false,
errorRetryCount: 0,
});
useSWR("CURRENT_USER", () => fetchCurrentUser());
useSWR("CURRENT_USER", () => fetchCurrentUser(), {
shouldRetryOnError: false,
revalidateOnFocus: false,
revalidateIfStale: false,
});

if (!instance && !error)
return (
Expand Down

0 comments on commit 780caf5

Please sign in to comment.