Cache Problem with Table
Unanswered
Wuchang bream posted this in #help-forum
Wuchang breamOP
I got a Server client that fetches the data from Supabase and provides it to a AG-Grid table.
When I navigate through couple of the pages somehow it's showing old data in the table. When I refresh the data is good again but after navigating it's gone.
Here is my server component and my supabase api call:
)
.neq('fk_status_id', '08ff3a91-b931-4156-a63f-4c6811b6e588')
.throwOnError();
return result
````
When I navigate through couple of the pages somehow it's showing old data in the table. When I refresh the data is good again but after navigating it's gone.
Here is my server component and my supabase api call:
'use server';
import 'ag-grid-community/styles/ag-grid.css'; // Mandatory CSS required by the Data Grid
import 'ag-grid-community/styles/ag-theme-quartz.css'; // Optional Theme applied to the Data Grid
import useSupabase from '~/core/hooks/use-supabase';
import { PageBody } from '~/core/ui/Page';
import Button from '~/core/ui/Button';
import {
Cog6ToothIcon,
InformationCircleIcon,
} from '@heroicons/react/24/outline';
import { Checkbox } from '~/core/ui/Checkbox';
import AppHeader from '../components/AppHeader';
import { ScanDMCModal } from './components/ScanDMCModal';
import { getAssets } from '~/lib/assets/database/queries';
import AssetTable from './components/AssetTable';
import NewAssetButton from './components/NewAssetButton';
async function AssetOverviewPage() {
const client = useSupabase();
const {data, error} = await getAssets(client);
return (
<>
<PageBody>
<div className="mx-5">
{
data && data.length === 0 ? <div>No data available</div> :
<AssetTable data={data!} />
}
</div>
</PageBody>
</>
);
}
export async function getAssets(client: Client) {
const result = await client
.from('asset')
.select<
string,
AssetData
>(
,asset_status:fk_status_id (),asset_category:fk_category_id (),storage_location:fk_storage_location_id (, storage_warehouse:fk_warehouse_id ()),order_line:fk_order_line_id (, order_header:fk_order_header_id ()), item:fk_item_id ()
)
.neq('fk_status_id', '08ff3a91-b931-4156-a63f-4c6811b6e588')
.throwOnError();
return result
````
3 Replies
Wuchang breamOP
I already tried this: https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#revalidate
But it isn't working
But it isn't working
Show how you are trying to revalidate @Wuchang bream
Also which version of nextjs are you on
Also which version of nextjs are you on
Wuchang breamOP
I'm using version 14.2.5 of NextJS.
I'm revalidating when for example saving and editing a object, the problem is that when my DB is updated elsewhere, the user has a stale state.
I'm revalidating when for example saving and editing a object, the problem is that when my DB is updated elsewhere, the user has a stale state.