Skip to content

Commit

Permalink
add suspense around EventItem
Browse files Browse the repository at this point in the history
  • Loading branch information
vmork authored and hampfh committed Jul 15, 2024
1 parent 8902da6 commit 7ab44bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/app/student/events/_components/EventItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export function EventItem({ event }: { event: Event }) {
const router = useRouter()
const searchParams = useSearchParams()
const [modalOpen, setModalOpen] = useState(false)
console.log("rendering", id, modalOpen, searchParams.get("id"))

useEffect(() => {
const queryId = searchParams.get("id")
Expand Down
14 changes: 7 additions & 7 deletions src/app/student/events/_components/EventsTimeLine.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { EventItem } from "@/app/student/events/_components/EventItem"
import { Event } from "@/components/shared/hooks/api/useEvents"
import { Suspense } from "react"

export function EventsTimeline({ events }: { events: Event[] }) {
const renderEvent = events.map(event => (
<EventItem
key={event.id}
event={event}></EventItem>
))

return (
<div className="relative mt-10 border-s border-melon-700">
{renderEvent}
{events.map(event => (
// EventItem uses useSearchParams, so needs to have a Suspense boundary
<Suspense key={event.id}>
<EventItem event={event}></EventItem>
</Suspense>
))}
</div>
)
}

0 comments on commit 7ab44bf

Please sign in to comment.