Data isn't being passed into function correctly - TanStack