diff --git a/app/lib/actions/locationActions.ts b/app/lib/actions/locationActions.ts index efad42c..4db8fe0 100644 --- a/app/lib/actions/locationActions.ts +++ b/app/lib/actions/locationActions.ts @@ -7,7 +7,7 @@ import { ObjectId } from 'mongodb'; import { withUser } from '@/app/lib/auth'; import { AuthenticatedUser } from '../types/next-auth'; import { gotoHome } from './navigationActions'; -import { Noto_Sans_Tamil_Supplement } from 'next/font/google'; +import { unstable_noStore as noStore } from 'next/cache'; import { asyncTimeout } from '../asyncTimeout'; export type State = { @@ -35,6 +35,8 @@ const UpdateLocation = FormSchema.omit({ _id: true }); */ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locationId: string | undefined, yearMonth: YearMonth | undefined, prevState:State, formData: FormData) => { + noStore(); + const validatedFields = UpdateLocation.safeParse({ locationName: formData.get('locationName'), locationNotes: formData.get('locationNotes'), @@ -95,6 +97,8 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat export const fetchAllLocations = withUser(async (user:AuthenticatedUser, year:number) => { + noStore(); + const dbClient = await getDbClient(); const { id: userId } = user; @@ -119,6 +123,8 @@ export const fetchAllLocations = withUser(async (user:AuthenticatedUser, year:nu export const fetchLocationById = withUser(async (user:AuthenticatedUser, locationID:string) => { + noStore(); + const dbClient = await getDbClient(); const { id: userId } = user; @@ -138,6 +144,8 @@ export const fetchLocationById = withUser(async (user:AuthenticatedUser, locatio export const deleteLocationById = withUser(async (user:AuthenticatedUser, locationID:string, yearMonth:YearMonth) => { + noStore(); + const dbClient = await getDbClient(); const { id: userId } = user; diff --git a/app/lib/actions/monthActions.ts b/app/lib/actions/monthActions.ts index 3e7948a..7b3d843 100644 --- a/app/lib/actions/monthActions.ts +++ b/app/lib/actions/monthActions.ts @@ -5,6 +5,7 @@ import { ObjectId } from 'mongodb'; import { Bill, BillingLocation, YearMonth } from '../db-types'; import { AuthenticatedUser } from '../types/next-auth'; import { withUser } from '../auth'; +import { unstable_noStore as noStore } from 'next/cache'; /** * Server-side action which adds a new month to the database @@ -15,6 +16,8 @@ import { withUser } from '../auth'; * @returns */ export const addMonth = withUser(async (user:AuthenticatedUser, { year, month }: YearMonth) => { + noStore(); + const { id: userId } = user; // update the bill in the mongodb @@ -60,6 +63,8 @@ export const addMonth = withUser(async (user:AuthenticatedUser, { year, month }: }); export const fetchAvailableYears = withUser(async (user:AuthenticatedUser) => { + noStore(); + const { id: userId } = user; const dbClient = await getDbClient();