perf: apply Vercel React best practices (async-parallel and server-serialization)
This commit is contained in:
@@ -37,18 +37,21 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||
|
||||
export default async function ServiceLocationPage({ params }: Props) {
|
||||
const { slug, location: locationSlug } = await params;
|
||||
const [service, location, settings] = await Promise.all([
|
||||
getServiceBySlug(slug),
|
||||
|
||||
// Vercel Best Practice: async-parallel - Fetch independent operations in parallel
|
||||
const service = await getServiceBySlug(slug);
|
||||
if (!service) notFound();
|
||||
|
||||
const [location, settings, projects] = await Promise.all([
|
||||
getLocationBySlug(locationSlug),
|
||||
getSettings()
|
||||
getSettings(),
|
||||
getProjectsByService(service.title)
|
||||
]);
|
||||
|
||||
if (!service || !location) {
|
||||
if (!location) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
const projects = await getProjectsByService(service.title);
|
||||
|
||||
const breadcrumbLd = {
|
||||
"@context": "https://schema.org",
|
||||
"@type": "BreadcrumbList",
|
||||
|
||||
Reference in New Issue
Block a user