Skip to content

Commit 759c7d3

Browse files
Marvyclaude
andcommitted
fix: resolve four frontend issues — dead Log In button, missing rel, window.location nav, missing AbortController
- #562: Remove non-functional Log In button from Navbar; WalletButton is the sole auth entry point - #560: Add rel="noopener noreferrer" to Stellar Expert external link in ActivityHistory to prevent reverse-tabnabbing - #561: Replace window.location.href with useRouter().push in NotificationDropdown and close dropdown on navigate - #563: Add AbortController to activity page useEffect; pass signal to fetch and abort on tab change / unmount to prevent stale-response races Closes #560 Closes #561 Closes #562 Closes #563 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ae68755 commit 759c7d3

4 files changed

Lines changed: 13 additions & 10 deletions

File tree

frontend/src/app/activity/page.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function ActivityPage() {
3232
const [hasMore, setHasMore] = useState(true);
3333

3434
const fetchActivity = useCallback(
35-
async (pageNum: number, tab: string, append: boolean = false) => {
35+
async (pageNum: number, tab: string, append: boolean = false, signal?: AbortSignal) => {
3636
if (!session?.publicKey) return;
3737
setLoading(true);
3838

@@ -43,7 +43,7 @@ export default function ActivityPage() {
4343
`${API_BASE_URL}/v1/events?address=${encodeURIComponent(session.publicKey)}` +
4444
`&page=${pageNum}&limit=${PAGE_SIZE}${typeQuery}`;
4545

46-
const response = await fetch(url);
46+
const response = await fetch(url, { signal });
4747
if (!response.ok) {
4848
throw new Error(`Failed to fetch activity (${response.status})`);
4949
}
@@ -62,6 +62,7 @@ export default function ActivityPage() {
6262
setHasMore(next.length === PAGE_SIZE);
6363
}
6464
} catch (error) {
65+
if (error instanceof DOMException && error.name === "AbortError") return;
6566
console.error("Failed to fetch activity:", error);
6667
if (!append) setEvents([]);
6768
setHasMore(false);
@@ -73,10 +74,11 @@ export default function ActivityPage() {
7374
);
7475

7576
useEffect(() => {
76-
if (status === "connected") {
77-
setPage(1);
78-
fetchActivity(1, activeTab, false);
79-
}
77+
if (status !== "connected") return;
78+
const controller = new AbortController();
79+
setPage(1);
80+
fetchActivity(1, activeTab, false, controller.signal);
81+
return () => controller.abort();
8082
}, [activeTab, status, fetchActivity]);
8183

8284
const loadMore = () => {

frontend/src/components/Navbar.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ export const Navbar = () => {
5252
{status === "connected" && session?.publicKey && (
5353
<NotificationDropdown publicKey={session.publicKey} />
5454
)}
55-
<Button variant="ghost" className="hidden sm:inline-flex">
56-
Log In
57-
</Button>
5855
<WalletButton />
5956
</div>
6057
</nav>

frontend/src/components/NotificationDropdown.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22
import React, { useState, useEffect, useCallback } from 'react';
3+
import { useRouter } from 'next/navigation';
34
import { useStreamEvents } from '@/hooks/useStreamEvents';
45
import { formatAmount } from '@/lib/amount';
56
import { Button } from './ui/Button';
@@ -19,6 +20,7 @@ interface NotificationItem {
1920
}
2021

2122
export const NotificationDropdown: React.FC<NotificationDropdownProps> = ({ publicKey }) => {
23+
const router = useRouter();
2224
const [isOpen, setIsOpen] = useState(false);
2325
const [notifications, setNotifications] = useState<NotificationItem[]>([]);
2426
const [isLoading, setIsLoading] = useState(false);
@@ -190,7 +192,8 @@ export const NotificationDropdown: React.FC<NotificationDropdownProps> = ({ publ
190192
size="sm"
191193
className="w-full text-xs"
192194
onClick={() => {
193-
window.location.href = '/activity';
195+
setIsOpen(false);
196+
router.push('/activity');
194197
}}
195198
>
196199
View All Activity

frontend/src/components/dashboard/ActivityHistory.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ export const ActivityHistory: React.FC<ActivityHistoryProps> = ({
153153
<a
154154
href={`https://stellar.expert/explorer/testnet/tx/${event.transactionHash}`}
155155
target="_blank"
156+
rel="noopener noreferrer"
156157
className="text-slate-500 hover:text-white transition-colors"
157158
title="View on Explorer"
158159
>

0 commit comments

Comments
 (0)