From a873095099a8de7684f286a7e02bb5e0f72402a4 Mon Sep 17 00:00:00 2001 From: Mathis Date: Wed, 12 Jun 2024 16:54:18 +0200 Subject: [PATCH] feat(component): Add loading and context handling The update enhances the account dialog component by introducing loading state management and improved context handling. Instead of displaying "Loading..." while user data is being fetched, a Skeleton component is now rendered. Additionally, detailed user data fields are now provided when setting the user data context. An effect hook supplies the proper loading state management. --- src/components/account-dialog.tsx | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/components/account-dialog.tsx b/src/components/account-dialog.tsx index 9827a88..7add37e 100644 --- a/src/components/account-dialog.tsx +++ b/src/components/account-dialog.tsx @@ -4,13 +4,7 @@ import { AccountInfo } from "@/components/account-info"; import { UserDataContext } from "@/components/providers/userdata-provider"; import { Skeleton } from "@/components/ui/skeleton"; import type { IUserData } from "@/interfaces/userdata.interface"; -import { - type Dispatch, - type SetStateAction, - useContext, - useEffect, - useState, -} from "react"; +import {Dispatch, SetStateAction, useContext, useEffect, useState} from "react"; export function AccountDialog() { const userContext = useContext(UserDataContext); @@ -45,12 +39,7 @@ export function AccountDialog() { return (
- > - } - /> + >} />
); }