import { View, Text, StyleSheet } from "react-native";
import { useQueryClient } from "@tanstack/react-query";
/**
* Lightweight debug panel that surfaces high-level QueryClient information and recently seen
* query keys. Intended primarily for the React Query dev tools modal.
*/
export function QueryDebugInfo() {
try {
const queryClient = useQueryClient();
const queries = queryClient.getQueryCache().getAll();
const mutations = queryClient.getMutationCache().getAll();
return (
Debug Info
QueryClient: ✅ Available
Queries: {queries.length}
Mutations: {mutations.length}
{queries.length > 0 && (
Query Keys:
{queries.slice(0, 3).map((query, index) => (
•{" "}
{Array.isArray(query.queryKey)
? query.queryKey.join(" - ")
: String(query.queryKey)}
))}
{queries.length > 3 && (
... and {queries.length - 3} more
)}
)}
);
} catch (error) {
return (
Debug Info
❌ QueryClient Error: {String(error)}
);
}
}
const styles = StyleSheet.create({
container: {
padding: 16,
backgroundColor: "rgba(0, 0, 0, 0.3)",
borderRadius: 8,
margin: 16,
borderWidth: 1,
borderColor: "rgba(255, 255, 255, 0.1)",
},
title: {
color: "#FFFFFF",
fontSize: 14,
fontWeight: "600",
marginBottom: 8,
},
subtitle: {
color: "#E5E7EB",
fontSize: 12,
fontWeight: "500",
marginTop: 8,
marginBottom: 4,
},
info: {
color: "#9CA3AF",
fontSize: 12,
marginBottom: 4,
},
error: {
color: "#EF4444",
fontSize: 12,
marginBottom: 4,
},
queriesList: {
marginTop: 4,
},
queryKey: {
color: "#60A5FA",
fontSize: 11,
marginLeft: 8,
marginBottom: 2,
},
more: {
color: "#9CA3AF",
fontSize: 11,
fontStyle: "italic",
marginLeft: 8,
},
});