diff --git a/apps/site/components/client/EditUsernameDialog.tsx b/apps/site/components/client/EditUsernameDialog.tsx index 97f6e0a3..e50bbac0 100644 --- a/apps/site/components/client/EditUsernameDialog.tsx +++ b/apps/site/components/client/EditUsernameDialog.tsx @@ -39,8 +39,8 @@ import { custom, } from 'viem' import { optimism } from 'viem/chains' -import { revalidationHelper } from '@/lib' import { useRouter } from 'next/navigation' +import { revalidatePath } from 'next/cache' interface UsernameDialogProps { open: boolean @@ -142,7 +142,7 @@ export function EditUsernameDialog({ open, setOpen }: UsernameDialogProps) { }) if (resp.success) { success = true - revalidationHelper('/', 'layout') + revalidatePath('/', 'layout') router.push(`/${form.getValues().username}`) } // reset context embeddedWallet + userId + username diff --git a/apps/site/lib/actions/index.ts b/apps/site/lib/actions/index.ts index a474919a..de4b704f 100644 --- a/apps/site/lib/actions/index.ts +++ b/apps/site/lib/actions/index.ts @@ -1,2 +1 @@ export * from './getItemsWithUserId' -export * from './revalidationHelper' diff --git a/apps/site/lib/actions/revalidationHelper.ts b/apps/site/lib/actions/revalidationHelper.ts deleted file mode 100644 index 09c67dbe..00000000 --- a/apps/site/lib/actions/revalidationHelper.ts +++ /dev/null @@ -1,10 +0,0 @@ -'use server' - -import { revalidatePath } from 'next/cache' - -export async function revalidationHelper( - path: string, - type?: 'page' | 'layout', -) { - revalidatePath(path, type) -} diff --git a/apps/site/lib/posts/processBatchCreateAddItemPost.ts b/apps/site/lib/posts/processBatchCreateAddItemPost.ts index a52a8826..2e396dd5 100644 --- a/apps/site/lib/posts/processBatchCreateAddItemPost.ts +++ b/apps/site/lib/posts/processBatchCreateAddItemPost.ts @@ -1,5 +1,4 @@ -import { getTxnInclusion, relayPostBatch, revalidationHelper } from '@/lib' -import { revalidatePath } from 'next/cache' +import { getTxnInclusion, relayPostBatch } from '@/lib' import { messageToCid } from '@/utils' import type { SignMessageModalUIOptions } from '@privy-io/react-auth' import { @@ -11,6 +10,7 @@ import { remove0xPrefix, } from 'scrypt' import { type Hash, type Hex, encodeAbiParameters } from 'viem' +import { revalidatePath } from 'next/cache' export async function processBatchCreateAddItemPost({ signer, @@ -130,7 +130,6 @@ export async function processBatchCreateAddItemPost({ if (txnInclusion) { revalidatePath('/', 'layout') - // revalidationHelper('/', 'layout') return true } else { console.error('Transaction was not successfully included.') diff --git a/apps/site/lib/posts/processBatchMoveItemPost.ts b/apps/site/lib/posts/processBatchMoveItemPost.ts index 30731a94..2de3b5ab 100644 --- a/apps/site/lib/posts/processBatchMoveItemPost.ts +++ b/apps/site/lib/posts/processBatchMoveItemPost.ts @@ -1,4 +1,4 @@ -import { getTxnInclusion, relayPostBatch, revalidationHelper } from '@/lib' +import { getTxnInclusion, relayPostBatch } from '@/lib' import type { SignMessageModalUIOptions } from '@privy-io/react-auth' import { type Post, @@ -8,7 +8,8 @@ import { getExpiration, remove0xPrefix, } from 'scrypt' -import { type Hash, type Hex, encodeAbiParameters } from 'viem' +import { type Hash, type Hex } from 'viem' +import { revalidatePath } from 'next/cache' type Diff = { channelId: string @@ -111,7 +112,7 @@ export async function processBatchMoveItemPost({ const txnInclusion = await getTxnInclusion(transactionHash) if (txnInclusion) { - revalidationHelper('/', 'layout') + revalidatePath('/', 'layout') return true } else { console.error('Transaction was not successfully included.') diff --git a/apps/site/lib/posts/processCreateChannelPost.ts b/apps/site/lib/posts/processCreateChannelPost.ts index 15a5401e..f5edfdd4 100644 --- a/apps/site/lib/posts/processCreateChannelPost.ts +++ b/apps/site/lib/posts/processCreateChannelPost.ts @@ -1,5 +1,5 @@ import { relayPost } from '@/lib' -import { getTxnInclusion, revalidationHelper } from '@/lib' +import { getTxnInclusion } from '@/lib' import type { SignMessageModalUIOptions } from '@privy-io/react-auth' import { encodeCreateChannelMsgBody, @@ -9,6 +9,7 @@ import { } from 'scrypt' import type { Hash, Hex } from 'viem' import { messageToCid } from '@/utils' +import { revalidatePath } from 'next/cache' export async function processCreateChannelPost({ signer, @@ -72,7 +73,7 @@ export async function processCreateChannelPost({ const txnInclusion = await getTxnInclusion(transactionHash) if (txnInclusion) { - revalidationHelper('/', 'layout') + revalidatePath('/', 'layout') return { success: true, channelId: channelCid } } else { console.error('Transaction was not successfully included.') diff --git a/apps/site/lib/posts/processEditRolesPost.ts b/apps/site/lib/posts/processEditRolesPost.ts index 24a34edc..0740f9a3 100644 --- a/apps/site/lib/posts/processEditRolesPost.ts +++ b/apps/site/lib/posts/processEditRolesPost.ts @@ -1,5 +1,5 @@ import { relayPost } from '@/lib' -import { getTxnInclusion, revalidationHelper } from '@/lib' +import { getTxnInclusion } from '@/lib' import type { SignMessageModalUIOptions } from '@privy-io/react-auth' import { MessageTypes, @@ -9,6 +9,7 @@ import { remove0xPrefix, } from 'scrypt' import type { Hash, Hex } from 'viem' +import { revalidatePath } from 'next/cache' export async function processEditRolesPost({ rid, @@ -70,7 +71,7 @@ export async function processEditRolesPost({ const txnInclusion = await getTxnInclusion(transactionHash) if (txnInclusion) { - revalidationHelper('/', 'layout') + revalidatePath('/', 'layout') return true } else { console.error('Transaction was not successfully included.') diff --git a/apps/site/lib/posts/processRemoveItemPost.ts b/apps/site/lib/posts/processRemoveItemPost.ts index 7f1d9695..21423b43 100644 --- a/apps/site/lib/posts/processRemoveItemPost.ts +++ b/apps/site/lib/posts/processRemoveItemPost.ts @@ -1,5 +1,5 @@ import { relayPost } from '@/lib' -import { getTxnInclusion, revalidationHelper } from '@/lib' +import { getTxnInclusion } from '@/lib' import type { SignMessageModalUIOptions } from '@privy-io/react-auth' import { encodeRemoveItemMsgBody, @@ -8,6 +8,7 @@ import { remove0xPrefix, } from 'scrypt' import type { Hash, Hex } from 'viem' +import { revalidatePath } from 'next/cache' export async function processRemoveItemPost({ signer, @@ -66,7 +67,7 @@ export async function processRemoveItemPost({ const txnInclusion = await getTxnInclusion(transactionHash) if (txnInclusion) { - revalidationHelper('/', 'layout') + revalidatePath('/', 'layout') return true } else { console.error('Transaction was not successfully included.')