Skip to content

Commit

Permalink
fix: avoid Missing Suspense boundary with useSearchParams
Browse files Browse the repository at this point in the history
  • Loading branch information
Pinx0 committed Nov 8, 2024
1 parent b27e1b6 commit 0e8cdf7
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 8 deletions.
12 changes: 10 additions & 2 deletions src/app/casos-activos/mapa/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
'use client';

import { useState, useEffect } from 'react';
import { useState, useEffect, Suspense } from 'react';
import { supabase } from '@/lib/supabase/client';
import SolicitudCard from '@/components/SolicitudCard';
import { useRouter, useSearchParams } from 'next/navigation';
import { tiposAyudaOptions } from '@/helpers/constants';
import Map, { PinMapa } from '@/components/map/map';
import PickupPoint from '@/components/PickupPoint';

export default function Mapa() {
export default function MapaPage() {
return (
<Suspense>
<Mapa />
</Suspense>
);
}

function Mapa() {
const searchParams = useSearchParams();
const router = useRouter();

Expand Down
13 changes: 11 additions & 2 deletions src/app/casos-activos/ofertas/page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { useEffect, useState } from 'react';
import { Suspense, useEffect, useState } from 'react';
import { HeartHandshake } from 'lucide-react';
import { supabase } from '@/lib/supabase/client';
import Pagination from '@/components/Pagination';
Expand All @@ -9,10 +9,19 @@ import { useRouter, useSearchParams } from 'next/navigation';
import { useTowns } from '@/context/TownProvider';
import OfferCard from '@/components/OfferCard';

export default function Ofertas() {
export default function OfertasPage() {
return (
<Suspense>
<Ofertas />
</Suspense>
);
}

function Ofertas() {
const { towns } = useTowns();
const searchParams = useSearchParams();
const router = useRouter();
const {} = router;

const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
Expand Down
12 changes: 10 additions & 2 deletions src/app/casos-activos/solicitudes/page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { useEffect, useState } from 'react';
import { Suspense, useEffect, useState } from 'react';
import { HeartHandshake } from 'lucide-react';
import { supabase } from '@/lib/supabase/client';
import SolicitudCard from '@/components/SolicitudCard';
Expand All @@ -14,7 +14,15 @@ import { useTowns } from '@/context/TownProvider';

const MODAL_NAME = 'solicitudes';

export default function Solicitudes() {
export default function SolicitudesPage() {
return (
<Suspense>
<Solicitudes />
</Suspense>
);
}

function Solicitudes() {
const { getTownById, towns } = useTowns();
const searchParams = useSearchParams();
const router = useRouter();
Expand Down
12 changes: 10 additions & 2 deletions src/app/ofertas/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { useState, useEffect } from 'react';
import { useState, useEffect, Suspense } from 'react';
import { HeartHandshake } from 'lucide-react';
import { supabase } from '@/lib/supabase/client';
import Pagination from '@/components/Pagination';
Expand All @@ -12,7 +12,15 @@ import OfferCard from '@/components/OfferCard';
import Link from 'next/link';
import { HelpRequestData } from '@/types/Requests';

export default function ListaSolicitudes() {
export default function ListaSolicitudesPage() {
return (
<Suspense>
<ListaSolicitudes />
</Suspense>
);
}

function ListaSolicitudes() {
const session = useSession();

const searchParams = useSearchParams();
Expand Down

0 comments on commit 0e8cdf7

Please sign in to comment.