Files
klz-cables.com/.pnpm-store/v10/files/ed/cb29ceb887a526e9daa1a17b9795ee8c9dbe4f16e1d4ef51ffb8b5a1c8a92e9c5675585b66ea8109d4f7f66f124312c1bdd24338ebca23947a97904f9e462c
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

86 lines
2.1 KiB
Plaintext

'use client';
import { c as _c } from "react/compiler-runtime";
import { useEffect, useRef } from 'react';
import { useFormFields } from '../../../forms/Form/context.js';
import { useDocumentTitle } from '../../../providers/DocumentTitle/index.js';
import { useTranslation } from '../../../providers/Translation/index.js';
import { formatDocTitle } from '../../../utilities/formatDocTitle/index.js';
export const SetDocumentTitle = props => {
const $ = _c(14);
const {
collectionConfig,
config,
fallback,
globalConfig
} = props;
const useAsTitle = collectionConfig?.admin?.useAsTitle;
let t0;
if ($[0] !== useAsTitle) {
t0 = t1 => {
const [fields] = t1;
return useAsTitle && fields && fields?.[useAsTitle] || null;
};
$[0] = useAsTitle;
$[1] = t0;
} else {
t0 = $[1];
}
const field = useFormFields(t0);
const hasInitialized = useRef(false);
const {
i18n
} = useTranslation();
const {
setDocumentTitle
} = useDocumentTitle();
const dateFormatFromConfig = config?.admin?.dateFormat;
const t1 = field?.value || "";
let t2;
if ($[2] !== collectionConfig || $[3] !== dateFormatFromConfig || $[4] !== fallback || $[5] !== globalConfig || $[6] !== i18n || $[7] !== t1 || $[8] !== useAsTitle) {
t2 = formatDocTitle({
collectionConfig,
data: {
id: "",
[useAsTitle]: t1
},
dateFormat: dateFormatFromConfig,
fallback,
globalConfig,
i18n
});
$[2] = collectionConfig;
$[3] = dateFormatFromConfig;
$[4] = fallback;
$[5] = globalConfig;
$[6] = i18n;
$[7] = t1;
$[8] = useAsTitle;
$[9] = t2;
} else {
t2 = $[9];
}
const title = t2;
let t3;
let t4;
if ($[10] !== setDocumentTitle || $[11] !== title) {
t3 = () => {
if (!hasInitialized.current) {
hasInitialized.current = true;
return;
}
setDocumentTitle(title);
};
t4 = [setDocumentTitle, title];
$[10] = setDocumentTitle;
$[11] = title;
$[12] = t3;
$[13] = t4;
} else {
t3 = $[12];
t4 = $[13];
}
useEffect(t3, t4);
return null;
};
//# sourceMappingURL=index.js.map