@conloca/cms-spa 0.1.10 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.mjs CHANGED
@@ -66,6 +66,9 @@ function SectionCard({ to, icon, title, description, count, countLabel, isLoadin
66
66
 
67
67
  //#endregion
68
68
  //#region src/components/CMSDashboard.tsx
69
+ function countAllAssets(nodes) {
70
+ return nodes.reduce((sum, node) => sum + node.assetCount + countAllAssets(node.children), 0);
71
+ }
69
72
  function CMSDashboard() {
70
73
  const { data: sitePages, isLoading: pagesLoading } = useSitePages("default");
71
74
  const { data: blocks, isLoading: blocksLoading } = useBlocks();
@@ -74,7 +77,7 @@ function CMSDashboard() {
74
77
  const pagesCount = sitePages?.items?.length ?? 0;
75
78
  const blocksCount = blocks?.items?.length ?? 0;
76
79
  const dataCount = dataEntries?.items?.length ?? 0;
77
- const mediaCount = (folderTree?.tree ?? []).reduce((sum, node) => sum + node.assetCount, 0);
80
+ const mediaCount = countAllAssets(folderTree?.tree ?? []);
78
81
  return /* @__PURE__ */ jsxs("div", {
79
82
  className: "p-6 max-w-5xl mx-auto",
80
83
  children: [/* @__PURE__ */ jsxs("div", {
@@ -1801,7 +1804,8 @@ function PageEditor({ pageId, entry, config, metadata, availableLocales, onSave,
1801
1804
  const { buildUrl } = useSiteBaseUrl();
1802
1805
  const handlePreview = useCallback(() => {
1803
1806
  const previewUrl = buildUrl(entry.localized.pathname || "/");
1804
- window.open(previewUrl, "_blank");
1807
+ const cacheBustedUrl = `${previewUrl}${previewUrl.includes("?") ? "&" : "?"}_t=${Date.now()}`;
1808
+ window.open(cacheBustedUrl, "_blank");
1805
1809
  }, [entry.localized.pathname, buildUrl]);
1806
1810
  const headerActionsPropsRef = useRef({
1807
1811
  onPublish,