Skip to content

Commit

Permalink
fix: edit roles/page to prevent tRPC error.t3-oss/create-t3-app#1599
Browse files Browse the repository at this point in the history
  • Loading branch information
banushi-a committed Mar 25, 2024
1 parent 7c552c8 commit 29065e9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions src/app/roles/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import HeaderLayout from "~/components/header-layout";
import { RoleReviewCard } from "~/components/role-review-card";
import SearchFilter from "~/components/search-filter";
import { api } from "~/trpc/server";
import { unstable_noStore as noStore } from "next/cache";

export default async function Roles() {
const roles: {
id: string;
title: string;
description: string | null;
companyId: string;
}[] = await api.role.list.query();
async function getRoles() {
noStore();
const roles = await api.role.list.query();
return roles;
}

const roles = await getRoles();

return (
<HeaderLayout>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function ReviewCardStars({ numStars }: { numStars: number }) {
numStars = Math.min(5, numStars);
numStars = Math.min(5, Math.round(numStars));

const yellowStar = (
<svg
Expand Down
2 changes: 1 addition & 1 deletion src/components/role-review-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
CardTitle,
} from "~/components/ui/card";
import { api } from "~/trpc/server";
import { ReviewCardStars } from "./ui/review-card-stars";
import { ReviewCardStars } from "./review-card-stars";

// TODO: move this somewehre else?
function formatDate(date: Date) {
Expand Down

0 comments on commit 29065e9

Please sign in to comment.