Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for click on gateway error #1217

Merged
merged 5 commits into from
Jan 13, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const ApiDiscoveryPage: React.FC = () => {
const hasNamespace = !!user?.namespace;
const title = (
<>
{(namespace.isFetching || namespace.isLoading) && (
{(namespace.isFetching) && (
<Skeleton width="400px" height="20px" mt={4} />
)}
{namespace.isSuccess && !namespace.isFetching && (
Expand Down
2 changes: 1 addition & 1 deletion src/nextapp/pages/manager/gateways/detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const NamespacesPage: React.FC = () => {
}, [client, mutate, router, toast, user]);
const title = (
<>
{(namespace.isFetching || namespace.isLoading) && (
{(namespace.isFetching) && (
<Skeleton width="400px" height="20px" mt={4} />
)}
{namespace.isSuccess && !namespace.isFetching && (
Expand Down
3 changes: 2 additions & 1 deletion src/nextapp/shared/services/auth/auth-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useSession, UserSessionResult } from './use-session';

const authContext = React.createContext<UserSessionResult>({
isLoading: false,
isFetching: false,
ok: false,
maintenance: false,
status: 'idle',
Expand Down Expand Up @@ -48,7 +49,7 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
requiresNamespace &&
!session.user.namespace;

if (noNamespace) {
if (noNamespace && session.isFetching == false) {
router?.push('/manager/gateways/list').then(() => {
toast({
title: `First select a Gateway to view that page`,
Expand Down
4 changes: 3 additions & 1 deletion src/nextapp/shared/services/auth/use-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface AuthFailedResponse {

export interface UserSessionResult {
isLoading: boolean;
isFetching: boolean;
ok: boolean;
maintenance: boolean;
user?: UserData;
Expand Down Expand Up @@ -64,7 +65,7 @@ export const getSessionL = async (): Promise<SessionData> => {
};

export const useSession = (): UserSessionResult => {
const { data, status, error, isLoading } = useQuery<SessionData, Error>(
const { data, status, error, isLoading, isFetching } = useQuery<SessionData, Error>(
'user',
getSessionL,
{
Expand All @@ -75,6 +76,7 @@ export const useSession = (): UserSessionResult => {

return {
isLoading,
isFetching,
ok: Boolean(data?.user),
user: data?.user,
maintenance: data?.maintenance,
Expand Down
Loading