Disable caching on partials only if used as partials
This commit is contained in:
parent
c311c0921d
commit
7229b78578
|
@ -13,7 +13,6 @@ import PageCredits from "./_components/PageCredits.astro";
|
|||
import type { EndpointPage } from "src/shared/payload/endpoint-types";
|
||||
|
||||
export const partial = true;
|
||||
Astro.locals.pageCaching = false;
|
||||
|
||||
interface Props {
|
||||
lang?: string;
|
||||
|
@ -21,6 +20,10 @@ interface Props {
|
|||
page?: EndpointPage;
|
||||
}
|
||||
|
||||
if (!Astro.props.page) {
|
||||
Astro.locals.pageCaching = false;
|
||||
}
|
||||
|
||||
const reqUrl = new URL(Astro.request.url);
|
||||
const lang = Astro.props.lang ?? reqUrl.searchParams.get("lang")!;
|
||||
const slug = Astro.props.slug ?? reqUrl.searchParams.get("slug")!;
|
||||
|
|
|
@ -10,7 +10,6 @@ import type { EndpointChronologyEvent } from "src/shared/payload/endpoint-types"
|
|||
import { payload } from "src/services";
|
||||
|
||||
export const partial = true;
|
||||
Astro.locals.pageCaching = false;
|
||||
|
||||
interface Props {
|
||||
lang?: string;
|
||||
|
@ -19,6 +18,10 @@ interface Props {
|
|||
index?: number;
|
||||
}
|
||||
|
||||
if (!Astro.props.event) {
|
||||
Astro.locals.pageCaching = false;
|
||||
}
|
||||
|
||||
const reqUrl = new URL(Astro.request.url);
|
||||
const lang = Astro.props.lang ?? reqUrl.searchParams.get("lang")!;
|
||||
const id = Astro.props.id ?? reqUrl.searchParams.get("id")!;
|
||||
|
|
Loading…
Reference in New Issue