Skip to content

Commit 65aa037

Browse files
removed spinner logic as we are passing fallback
1 parent 2c51162 commit 65aa037

3 files changed

Lines changed: 9 additions & 28 deletions

File tree

client/trading-dashboard/app/not-found.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
// src/app/not-found.tsx (or your custom 404 file location)
21
"use client";
3-
42
import { useEffect } from "react";
53
import Link from "next/link";
64
import { usePathname } from "next/navigation";
75
import { AlertTriangle, Home } from "lucide-react";
86

97
const NotFound = () => {
10-
// Correctly get the pathname using the usePathname hook
118
const pathname = usePathname();
129

1310
// Log the error to the console for debugging purposes
@@ -24,7 +21,6 @@ const NotFound = () => {
2421
<AlertTriangle className="h-16 w-16 text-yellow-500" />
2522
</div>
2623

27-
{/* Gradient text effect for the 404 status code */}
2824
<h1 className="bg-gradient-to-r from-purple-500 to-pink-500 bg-clip-text text-8xl font-extrabold text-transparent">
2925
404
3026
</h1>

client/trading-dashboard/components/TickerGrid.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import TickerCard from "./TickerCard";
33
import { Ticker } from "@/types";
44
import { useQuery } from "@tanstack/react-query";
5-
import { notFound } from "next/navigation";
65
import { API_BASE_URL, MOCK_TICKERS } from "@/constants";
76
import { LoadingSpinner } from "./ui/LoadingSpinner";
87

@@ -19,20 +18,17 @@ async function getPosts(): Promise<Ticker[]> {
1918
return tickers;
2019
}
2120
const TickerGrid = () => {
22-
const { data, isLoading, error } = useQuery<Ticker[], Error>({
21+
const { data, error } = useQuery<Ticker[], Error>({
2322
queryKey: ["tickers"],
2423
queryFn: getPosts,
2524
refetchInterval: 1000,
2625
placeholderData: MOCK_TICKERS,
2726
});
2827

29-
if (isLoading)
30-
return (
31-
<div className="py-16 px-4">
32-
<LoadingSpinner />
33-
</div>
34-
);
35-
if (error) return null;
28+
if (error) {
29+
console.error("Error fetching tickers:", error);
30+
}
31+
3632
return (
3733
<section className="py-16 px-4 bg-background">
3834
<div className="container mx-auto max-w-7xl">
@@ -45,7 +41,10 @@ const TickerGrid = () => {
4541
</p>
4642
</div>
4743

48-
<div data-testid="ticker-grid" className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
44+
<div
45+
data-testid="ticker-grid"
46+
className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"
47+
>
4948
{data &&
5049
data.length > 0 &&
5150
data?.map((ticker) => (

client/trading-dashboard/components/__tests__/TickerGrid.test.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,6 @@ describe("TickerGrid", () => {
2121
jest.clearAllMocks();
2222
});
2323

24-
it("displays loading spinner initially", () => {
25-
(global.fetch as jest.Mock).mockImplementation(
26-
() => new Promise(() => {}) // Never resolves
27-
);
28-
29-
render(
30-
<QueryClientProvider client={queryClient}>
31-
<TickerGrid />
32-
</QueryClientProvider>
33-
);
34-
35-
expect(screen.getByRole("status")).toBeInTheDocument();
36-
});
37-
3824
it("renders ticker cards when data is fetched successfully", async () => {
3925
const mockTickers = [
4026
{

0 commit comments

Comments
 (0)