Skip to content

Commit 06b1297

Browse files
committed
refactor(profile): fix path invalidation in refreshData methods
- remove type for specific path - add `/profile/${address}` for invalidation path because /page/[address] also seems have cache
1 parent 80a0bbd commit 06b1297

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

components/profile/unclaimed-hypercert-batchClaim-button.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ export default function UnclaimedHypercertBatchClaimButton({
5959
});
6060

6161
await revalidatePathServerAction([
62-
{ path: `/profile/${address}?tab`, type: "page" },
63-
{ path: `/profile/${address}?tab=hypercerts-claimable`, type: "page" },
64-
{ path: `/profile/${address}?tab=hypercerts-owned`, type: "page" },
62+
`/profile/${address}`,
63+
`/profile/${address}?tab`,
64+
`/profile/${address}?tab=hypercerts-claimable`,
65+
`/profile/${address}?tab=hypercerts-owned`,
6566
...hypercertViewInvalidationPaths,
66-
{ path: "/", type: "layout" },
6767
]).then(async () => {
6868
setTimeout(() => {
6969
// refresh after 5 seconds

components/profile/unclaimed-hypercert-claim-button.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,15 @@ export default function UnclaimedHypercertClaimButton({
3535

3636
const refreshData = async (address: string) => {
3737
await revalidatePathServerAction([
38-
{ path: `/profile/${address}?tab`, type: "page" },
39-
{ path: `/profile/${address}?tab=hypercerts-claimable`, type: "page" },
40-
{ path: `/profile/${address}?tab=hypercerts-owned`, type: "page" },
41-
{ path: `/hypercerts/${selectedHypercert?.hypercert_id}`, type: "page" },
42-
{ path: "/", type: "layout" },
43-
]).then(async () => {
38+
`/profile/${address}`,
39+
`/profile/${address}?tab`,
40+
`/profile/${address}?tab=hypercerts-claimable`,
41+
`/profile/${address}?tab=hypercerts-owned`,
42+
`/hypercerts/${selectedHypercert?.hypercert_id}`,
43+
]).then(() => {
4444
setTimeout(() => {
4545
// refresh after 5 seconds
4646
router.refresh();
47-
4847
// push to the profile page with the hypercerts-claimable tab
4948
// because revalidatePath will revalidate on the next page visit.
5049
router.push(`/profile/${address}?tab=hypercerts-claimable`);

0 commit comments

Comments
 (0)