Conversation
PR Review: Add channel storage page🟡 Code Quality and Best PracticesIssue 1: Inconsistent SWR key construction in useChannelStorage.ts:23 The SWR key includes both // Current (incorrect)
const { data, error } = useSWR(
[`/games/${activeGame.id}/game-channels/${channelId}/storage`, search, page],
fetcher
)Compare with useLeaderboardEntries.ts:40-44 which correctly includes all dependencies in both the key AND fetcher params. Fix: The fetcher should receive all dependency values from the SWR key, or the search/page should be accessed from the closure (current approach works but is inconsistent with codebase patterns). 🟡 Potential Bugs or IssuesIssue 2: Missing null check for channelId in ChannelStorage.tsx:36 Using the non-null assertion operator ( // Current (line 36)
useChannelStorage(activeGame, Number(channelId!), debouncedSearch, page)While the 404 handling exists, Fix: Add validation or use a default value to avoid 🔵 Performance ConsiderationsIssue 3: Empty dependency in Channels.tsx useEffect Line 43-45 has a useEffect with useEffect(() => {
if (!showModal) setEditingChannel(null)
}, [showModal, editingChannel]) // editingChannel is unnecessaryThis causes the effect to run on every Fix: Remove Security ConcernsNo issues found Overall: The PR follows the project patterns well. The main concerns are consistency with existing SWR hook patterns and a minor redundant dependency in useEffect. The functionality looks solid otherwise. |
21e3b1d to
93e079b
Compare
93e079b to
818b364
Compare
No description provided.