import { useQuery } from '@tanstack/react-query'; import { useParams, useNavigate } from 'react-router-dom'; import { fetchPageHistory } from '../apiTools.jsx'; import { useFixLinks } from '../clientStuff.jsx'; import './Pages.css'; function HistoryView() { const noLoad = useFixLinks(); const { pagenumber, editid } = useParams(); const navigate = useNavigate(); const { isPending, error, data } = useQuery({ // fetch the currrent values queryKey: ['page history', pagenumber], queryFn: () => fetchPageHistory(pagenumber) }) const edits = data; const ready = !(error || isPending); const pageTitle = edits ? edits[0]?.title : "[no title]"; return (