fix: mii reviewedAt property for time select and responsiveness for sort menus

also bypassCache profile url query param
This commit is contained in:
trafficlunar 2026-04-22 16:54:00 +01:00
parent af37b05ab1
commit 2209a17687
5 changed files with 16 additions and 5 deletions

View file

@ -20,9 +20,10 @@ interface ApiResponse {
interface Props {
userId?: number;
parentPage?: "likes";
bypassCache?: boolean;
}
export default function MiiList({ parentPage, userId }: Props) {
export default function MiiList({ parentPage, userId, bypassCache }: Props) {
const [searchParams] = useSearchParams();
const [data, setData] = useState<ApiResponse | null>(null);
const [loading, setLoading] = useState(true);
@ -34,6 +35,7 @@ export default function MiiList({ parentPage, userId }: Props) {
const params = new URLSearchParams(searchParams.toString());
if (userId) params.append("userId", userId.toString());
if (parentPage) params.append("parentPage", parentPage);
if (bypassCache) params.append("bypassCache", "true");
fetch(`${import.meta.env.VITE_API_URL}/api/mii/list?${params.toString()}`, { credentials: "include" })
.then((res) => {
@ -71,7 +73,7 @@ export default function MiiList({ parentPage, userId }: Props) {
<span className="text-lg text-amber-700">{data.totalCount === 1 ? "Mii" : "Miis"}</span>
</div>
<div className="relative flex items-center justify-end gap-2 w-full md:max-w-2/3 max-md:justify-center">
<div className="relative flex flex-wrap items-center justify-end gap-2 w-full md:max-w-2/3 max-md:justify-center">
<FilterMenu />
<SortSelect />
<TimeRangeSelect />

View file

@ -1,8 +1,14 @@
import { useParams } from "react-router";
import MiiList from "../../components/mii/list";
import { useStore } from "@nanostores/react";
import { session } from "../../session";
export default function ProfilePage() {
const { id } = useParams();
const $session = useStore(session);
return <MiiList userId={Number(id)} />;
const userId = Number(id ?? $session?.user?.id);
const isOwnProfile = !!$session?.user?.id && userId === Number($session.user.id);
return <MiiList userId={Number(id)} bypassCache={isOwnProfile} />;
}