Cleanup: React Query dependency is overkill (only 2 mutations, no queries) #128

Closed
opened 2026-05-17 21:27:52 -05:00 by null · 0 comments
Owner

Problem

The project uses @tanstack/react-query (listed as a dependency) but only uses useMutation in two places (Contact.jsx and Support.jsx). No queries, no caching, no invalidation — just two POST mutations.

React Query adds ~40KB to the bundle for functionality that could be replaced with a 20-line useAsync hook or plain fetch with a loading state.

Fix

Either:

  • A) Remove @tanstack/react-query and replace useMutation with a simple custom hook
  • B) Keep it if planning to add data-fetching features (like a blog, testimonials) that would benefit from caching

If keeping, the QueryClient in main.jsx sets staleTime to 5 minutes — this is pointless with no queries.

Files

  • package.json — @tanstack/react-query dependency
  • src/main.jsx — QueryClientProvider setup
  • src/pages/Contact.jsx — useMutation
  • src/pages/Support.jsx — useMutation

Severity

Low — unnecessary bundle weight, no functional impact

## Problem The project uses @tanstack/react-query (listed as a dependency) but only uses `useMutation` in two places (Contact.jsx and Support.jsx). No queries, no caching, no invalidation — just two POST mutations. React Query adds ~40KB to the bundle for functionality that could be replaced with a 20-line `useAsync` hook or plain `fetch` with a loading state. ## Fix Either: - A) Remove @tanstack/react-query and replace `useMutation` with a simple custom hook - B) Keep it if planning to add data-fetching features (like a blog, testimonials) that would benefit from caching If keeping, the QueryClient in main.jsx sets staleTime to 5 minutes — this is pointless with no queries. ## Files - package.json — @tanstack/react-query dependency - src/main.jsx — QueryClientProvider setup - src/pages/Contact.jsx — useMutation - src/pages/Support.jsx — useMutation ## Severity Low — unnecessary bundle weight, no functional impact
null closed this issue 2026-05-17 22:33:43 -05:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: null/Queue-North-Website#128
No description provided.