From 84b5649967f5f5f2f7fc91670d03540517b881bb Mon Sep 17 00:00:00 2001 From: Darshan Gowda T S Date: Tue, 19 May 2026 15:08:32 +0530 Subject: [PATCH] Improve async error handling and loading states --- src/app/error.tsx | 22 ++++++++++++++++++++++ src/app/loading.tsx | 7 +++++++ src/components/loader.tsx | 7 +++++++ 3 files changed, 36 insertions(+) create mode 100644 src/app/error.tsx create mode 100644 src/app/loading.tsx create mode 100644 src/components/loader.tsx diff --git a/src/app/error.tsx b/src/app/error.tsx new file mode 100644 index 0000000..e66125e --- /dev/null +++ b/src/app/error.tsx @@ -0,0 +1,22 @@ +"use client"; + +export default function Error({ + error, + reset, +}: { + error: Error; + reset: () => void; +}) { + return ( +
+

Something went wrong

+ + +
+ ); +} \ No newline at end of file diff --git a/src/app/loading.tsx b/src/app/loading.tsx new file mode 100644 index 0000000..acd5dbb --- /dev/null +++ b/src/app/loading.tsx @@ -0,0 +1,7 @@ +export default function Loading() { + return ( +
+
+
+ ); +} \ No newline at end of file diff --git a/src/components/loader.tsx b/src/components/loader.tsx new file mode 100644 index 0000000..5a31482 --- /dev/null +++ b/src/components/loader.tsx @@ -0,0 +1,7 @@ + export default function Loader() { + return ( +
+
+
+ ); +} \ No newline at end of file