A component was suspended by an uncached promise.
Unanswered
American Chinchilla posted this in #help-forum
American ChinchillaOP
how do i work it out? this is the code:
"use client";
// ... imports
import useSheetStore from "@/store/sheet";
import { getUsers } from "@/utils/api";
import { sendToast } from "@/utils/sendToast";
import { use } from "react";
const AcceptSidebar = () => {
const { setOpen, setContent } = useSheetStore();
const { data: users } = use(getUsers());
const unacceptedUsers = users.filter((user) => !user.confirmed);
const unacceptedUsersAmount = unacceptedUsers.length;
const data = [true, true];
const handleShowSheet = (sheetType: SidebarAcceptEnum) => {
if (!data[sheetType - 1]) {
sendToast({
type: "error",
headline: "Brak danych",
body: "Brak danych do wyświetlenia",
position: "bottom-center",
});
} else {
setOpen(true);
}
};
return (
<div className="flex flex-col items-start gap-1 w-full">
<SidebarTab
title="Akceptacja rejestracji"
badge={{ type: "primary", amount: unacceptedUsersAmount }}
onClick={() => {handleShowSheet(SidebarAcceptEnum.ACCEPT_REGISTRATION);
setContent(<AcceptRegistrationSheet users={users} />);
}}
>
<AcceptRegistrationIcon />
</SidebarTab>
</div>
);
};
export default AcceptSidebar;1 Reply
American ChinchillaOP
everytime i click it rerenders