Skip to content

chore: delete dead code (#104) - #110

Open
rahulkr182 wants to merge 1 commit into
paro-studio:mainfrom
rahulkr182:chore/delete-dead-code
Open

rahulkr182 wants to merge 1 commit into
paro-studio:mainfrom
rahulkr182:chore/delete-dead-code

Conversation

@rahulkr182

Copy link
Copy Markdown
Contributor

What does this change?

Fixes #104.

  • NavLink: deleted unused src/components/NavLink.tsx.
  • deleteAvatar & deleteBanner: removed uncalled functions from src/services/supabase/storage.ts.
  • useTags: removed uncalled hook from src/hooks/usePrompts.ts.
  • ExternalLink: removed unused import from src/pages/Profile.tsx.
  • mobileTags & mobileExcludedTags: removed unused computed state in src/pages/Index.tsx.
  • refreshKey: removed unused refreshKey state from src/pages/Index.tsx (feed refresh on delete is already handled by TanStack Query's cache invalidation in PromptCard).
  • sonner: removed Sonner component mount in src/App.tsx, deleted src/components/ui/sonner.tsx, and uninstalled sonner package dependency.
  • .slice(0, 8): removed redundant .slice(0, 8) in src/pages/PromptDetail.tsx where recommendation queries already cap results at 4.
  • viewCount: rendered viewCount stat with Eye icon in src/components/prompts/PromptCard.tsx and src/pages/PromptDetail.tsx, and added a test in PromptCard.test.tsx.
  • UserProfile.verified: added verified?: boolean to UserProfile in src/lib/types.ts and mapped verified: supabaseProfile.verified ?? false in src/hooks/useAuth.tsx.
  • Preserved getProfileByUsername and getFollowingCount as noted in the issue for future following feed and username routing.

Why?

Removes dead exports, unused components, uncalled hooks, redundant slices, and an unused dependency (sonner), while displaying the existing viewCount metric and correctly preserving verified on authenticated user profiles.

How was it tested?

  • Ran npm test (all 15 test files, 81 tests passing, including new viewCount test in PromptCard.test.tsx).
  • Ran npm run lint (0 errors).
  • Ran npm run typecheck (0 errors).
  • Ran npm run build (successful production bundle build; bundle size reduced).
  • Ran npm run db:schema:check (up to date).

Checklist

  • npm run lint passes
  • npm run typecheck passes
  • npm test passes
  • npm run build passes
  • Any new root-relative asset (/foo.png) is in public/, not src/assets/
  • No credentials, keys, or .env files are included
  • I've read the CLA in CONTRIBUTING.md

- Delete unused NavLink component (src/components/NavLink.tsx)
- Delete uncalled deleteAvatar and deleteBanner functions in storage.ts
- Delete unused useTags hook in usePrompts.ts
- Remove unused ExternalLink import in Profile.tsx
- Remove unused mobileTags/mobileExcludedTags in Index.tsx
- Remove unused refreshKey state and redundant onDelete callback in Index.tsx
- Remove Sonner component, mounting in App.tsx, and uninstall sonner dependency
- Remove redundant .slice(0, 8) on recommendations list capped at 4 in PromptDetail.tsx
- Render viewCount in PromptCard and PromptDetail stats
- Add verified to UserProfile interface and map in useAuth

@aashu2006 aashu2006 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the deletions all check out, nice work @rahulkr182 . Two things before merge:

  • package-lock.json strips libc from 64 lines with no version changes, which means it was regenerated on an older npm than the repo is on. Please regenerate on current npm so it stops flip-flopping.
  • verified on UserProfile has no consumer. Profile.tsx builds its own object and the auth profile never reads it. Either drop it or say what is going to use it. Also needs a rebase because #111 has changed PromptCard.tsx and PromptCard.test.tsx

The view count is fine to keep, viewCount was already a declared but unrendered prop so wiring it up fits the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: delete dead code

2 participants