@@ -4,10 +4,10 @@ This document outlines potential improvements for the feeds feature based on cod
44
55## Performance & Optimization
66
7- 1 . ** Implement infinite scroll** instead of traditional pagination
7+ <!-- 1. **Implement infinite scroll** instead of traditional pagination
88 - Better UX for feed browsing
99 - Reduces cognitive load on users
10- - More engaging scrolling experience
10+ - More engaging scrolling experience -->
1111
12122 . ** Add optimistic updates** for upvotes/comments
1313 - Instant UI feedback before server response
@@ -19,17 +19,12 @@ This document outlines potential improvements for the feeds feature based on cod
1919 - Automatic background refetching
2020 - Built-in stale-while-revalidate pattern
2121
22- 4 . ** Add real-time updates** using Supabase subscriptions
23- - New posts appear automatically without manual refresh
24- - Live upvote/comment count updates
25- - Better collaboration experience
26-
27- 5 . ** Optimize image loading**
22+ 4 . ** Optimize image loading**
2823 - Add blur placeholders (Next.js Image component supports this)
2924 - Lazy loading for images below the fold
3025 - Progressive image loading
3126
32- 6 . ** Memoize filtered posts computation**
27+ 5 . ** Memoize filtered posts computation**
3328 - Already using ` useMemo ` in Feed.tsx:25-41
3429 - Could optimize further with better dependency keys
3530 - Consider moving heavy filtering to server-side
@@ -41,11 +36,11 @@ This document outlines potential improvements for the feeds feature based on cod
4136 - Multiple categories per post
4237 - Visual category badges
4338
44- 8 . ** Sort options**
39+ <!-- 8. **Sort options**
4540 - Newest first (current default)
4641 - Most upvoted
4742 - Trending (combination of recent + upvotes)
48- - Most commented
43+ - Most commented -->
4944
50459 . ** Bookmark/save posts**
5146 - Let users save posts for later reading
@@ -57,10 +52,10 @@ This document outlines potential improvements for the feeds feature based on cod
5752 - Show content excerpt with "Read more..."
5853 - Better preview of post content
5954
60- 11 . ** Comment count display** on PostCard
55+ <!-- 11. **Comment count display** on PostCard
6156 - Show engagement metrics at a glance
6257 - Currently only shows upvote count
63- - Display next to upvote button
58+ - Display next to upvote button -->
6459
656012 . ** Share functionality**
6661 - Copy link to clipboard
@@ -72,22 +67,17 @@ This document outlines potential improvements for the feeds feature based on cod
7267 - Notify mentioned users
7368 - Highlight mentions in text
7469
75- 14 . ** Image gallery view** for posts with multiple images
76- - Currently supports single thumbnail
77- - Carousel/gallery for multiple images
78- - Lightbox for full-size viewing
79-
80- 15 . ** Draft posts**
70+ 14 . ** Draft posts**
8171 - Save work in progress before publishing
8272 - Auto-save functionality
8373 - Resume editing later
8474
8575## Code Quality & Architecture
8676
87- 16 . ** Fix hardcoded admin check** (page.tsx:13)
77+ <!-- 16. **Fix hardcoded admin check** (page.tsx:13)
8878 - Currently: `const [isAdmin, setIsAdmin] = useState(true);`
8979 - Should initialize as `false`
90- - Security risk if not properly validated
80+ - Security risk if not properly validated -->
9181
928217 . ** Consolidate duplicate user role fetching**
9383 - Used in page.tsx:20-27 and PostView.tsx:48-52
@@ -110,15 +100,15 @@ This document outlines potential improvements for the feeds feature based on cod
110100 - Graceful degradation
111101 - User-friendly error messages
112102
113- 21 . ** Loading skeletons** for individual post cards
103+ <!-- 21. **Loading skeletons** for individual post cards
114104 - Currently only in PostView.tsx:110-115
115105 - Add to Feed.tsx while posts are loading
116- - Better loading states
106+ - Better loading states -->
117107
118- 22 . ** Extract magic numbers** to constants
108+ <!-- 22. **Extract magic numbers** to constants
119109 - `postsPerPage: 6` (Feed.tsx:43)
120110 - Debounce delay `500ms` (page.tsx:32)
121- - Create ` constants.ts ` file
111+ - Create `constants.ts` file -->
122112
12311323 . ** Consistent async/await error handling**
124114 - Some functions use try/catch, others don't
@@ -234,29 +224,29 @@ This document outlines potential improvements for the feeds feature based on cod
234224
235225These improvements can be implemented quickly and provide immediate value:
236226
237- - ✅ ** Fix the ` isAdmin ` initialization bug** (page.tsx:13)
227+ <!-- - ✅ **Fix the `isAdmin` initialization bug** (page.tsx:13)
238228 - Change `useState(true)` to `useState(false)`
239229 - 1-line fix, important security improvement
240230
241231- ✅ **Add comment count to PostCard component**
242232 - Query comment count in getPosts
243233 - Display next to upvote count
244- - ~ 20 lines of code
234+ - ~20 lines of code -->
245235
246- - ✅ ** Extract constants**
236+ <!-- - ✅ **Extract constants**
247237 - Create `_constants/index.ts`
248238 - Move magic numbers: `POSTS_PER_PAGE = 6`, `SEARCH_DEBOUNCE_MS = 500`
249- - Better maintainability
239+ - Better maintainability -->
250240
251- - ✅ ** Add loading skeleton for post cards**
241+ <!-- - ✅ **Add loading skeleton for post cards**
252242 - Reuse existing Skeleton component
253243 - Show while `fetchPosts()` is loading
254- - ~ 15 lines of code
244+ - ~15 lines of code -->
255245
256- - ✅ ** Add empty state when no posts match search**
246+ <!-- - ✅ **Add empty state when no posts match search**
257247 - Simple conditional in Feed.tsx
258248 - Better UX than empty grid
259- - ~ 10 lines of code
249+ - ~10 lines of code -->
260250
261251## File References
262252
0 commit comments