Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/forum/components/forum-navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type Props = {

export function ForumNavbar({ forumId, renderButtons }: Props) {
return (
<nav className="flex justify-between items-center w-full max-w-xl mx-auto py-6 fixed top-0 left-0 right-0 bg-background container">
<nav className="flex justify-between items-center w-full max-w-xl mx-auto py-6 fixed top-0 left-0 right-0 bg-background container z-50">
<div className="flex items-center gap-2">
<Link href="/forum" className="font-bold tracking-tighter">
um<i>edu</i>
Expand Down
11 changes: 5 additions & 6 deletions app/forum/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable react-hooks/exhaustive-deps */
"use client";

import { useEffect, useRef } from "react";
import { useVirtualizer } from "@tanstack/react-virtual";
import { useEffect } from "react";
import { useWindowVirtualizer } from "@tanstack/react-virtual";
import { useInfiniteQuery } from "@tanstack/react-query";
import { AlertCircleIcon, MessageCircleDashedIcon } from "lucide-react";
import { useThrottledCallback } from "@tanstack/react-pacer/throttler";
Expand Down Expand Up @@ -43,13 +43,12 @@ export default function FeedPage() {
});

const allPosts = data?.pages.flatMap((page) => page.posts) ?? [];
const parentRef = useRef<HTMLDivElement>(null);

const virtualizer = useVirtualizer({
const virtualizer = useWindowVirtualizer({
count: hasNextPage ? allPosts.length + 1 : allPosts.length,
getScrollElement: () => parentRef.current,
estimateSize: () => 200,
paddingEnd: 100,
overscan: 6,
});

const handleNextPage = useThrottledCallback(
Expand Down Expand Up @@ -110,7 +109,7 @@ export default function FeedPage() {
}

return (
<div ref={parentRef} className="h-[700px] w-full overflow-auto">
<div className="w-full overflow-auto">
{allPosts.length === 0 && !isFetching && (
<Alert>
<MessageCircleDashedIcon />
Expand Down
2 changes: 1 addition & 1 deletion app/forum/submit/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function SubmitPage() {

return (
<form
className="space-y-6 w-full"
className="space-y-6 w-full min-h-screen"
onSubmit={(e) => {
e.preventDefault();
form.handleSubmit();
Expand Down
Loading