feat: tag all PocketBase fetches for ISR cache invalidation
Each getCollection/getFirstRecord call now passes the collection name as a cache tag so revalidateTag can target individual collections.
This commit is contained in:
@@ -10,6 +10,7 @@ import { SectionsAccordion } from '$widgets/SectionsAccordion';
|
||||
export async function generateStaticParams() {
|
||||
const { items: sections } = await getCollection<SectionRecord>('sections', {
|
||||
sort: 'order',
|
||||
tags: ['sections'],
|
||||
});
|
||||
return [{}, ...sections.map((s) => ({ slug: [s.slug] }))];
|
||||
}
|
||||
@@ -26,6 +27,7 @@ export default async function SectionPage({ params }: Props) {
|
||||
|
||||
const { items: sections } = await getCollection<SectionRecord>('sections', {
|
||||
sort: 'order',
|
||||
tags: ['sections'],
|
||||
});
|
||||
|
||||
if (sections.length === 0) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { RichText } from '$shared/ui';
|
||||
* Displays personal biography content from PocketBase.
|
||||
*/
|
||||
export default async function BioSection() {
|
||||
const data = await getFirstRecord<PageContentRecord>('bio');
|
||||
const data = await getFirstRecord<PageContentRecord>('bio', { tags: ['bio'] });
|
||||
|
||||
if (!data) {
|
||||
notFound();
|
||||
|
||||
@@ -10,6 +10,7 @@ import { formatMonthYearRange } from '$shared/lib';
|
||||
export default async function ExperienceSection() {
|
||||
const { items } = await getCollection<ExperienceRecord>('experience', {
|
||||
sort: 'order',
|
||||
tags: ['experience'],
|
||||
});
|
||||
|
||||
return (
|
||||
|
||||
@@ -10,6 +10,7 @@ import { Button, Link } from '$shared/ui';
|
||||
export async function Footer() {
|
||||
const settings = await getFirstRecord<SiteSettingsRecord>('site_settings', {
|
||||
expand: 'contacts,contacts.socials',
|
||||
tags: ['site_settings'],
|
||||
});
|
||||
|
||||
const cvUrl = settings?.cv ? buildFileUrl(settings.collectionId, settings.id, settings.cv) : null;
|
||||
|
||||
@@ -8,7 +8,7 @@ import { RichText } from '$shared/ui';
|
||||
* Displays primary introduction content from PocketBase.
|
||||
*/
|
||||
export default async function IntroSection() {
|
||||
const data = await getFirstRecord<PageContentRecord>('intro');
|
||||
const data = await getFirstRecord<PageContentRecord>('intro', { tags: ['intro'] });
|
||||
|
||||
if (!data) {
|
||||
notFound();
|
||||
|
||||
@@ -10,6 +10,7 @@ import { buildFileUrl } from '$shared/lib';
|
||||
export default async function ProjectsSection() {
|
||||
const { items } = await getCollection<ProjectRecord>('projects', {
|
||||
sort: 'order',
|
||||
tags: ['projects'],
|
||||
});
|
||||
|
||||
return (
|
||||
|
||||
@@ -11,6 +11,7 @@ import { Badge } from '$shared/ui';
|
||||
export default async function SkillsSection() {
|
||||
const data = await getCollection<SkillRecord>('skills', {
|
||||
sort: 'category,order',
|
||||
tags: ['skills'],
|
||||
});
|
||||
|
||||
if (!data.items.length) {
|
||||
|
||||
Reference in New Issue
Block a user