Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/content manager/space usage: do not include the revisions size in the treemap
Adorian Doranf23b487b14d2
diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/index.tsx b/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/index.tsxindex 5bcd5a30dc..0256918fd9 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/index.tsx+++ b/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/index.tsx@@ -21,10 +21,10 @@ type SpaceUsageView = "overview" | "browse";export default function SpaceUsage({ sectionSwitcher }: ContentManagerSectionProps) {const [ view, setView ] = useState<SpaceUsageView>("overview");// Fetched in both views: the treemap consumes it, and the status line is view-independent.- // Revisions count towards the ranking because the treemap shows them in a cell's area — asking- // for one basis and drawing the other would hide notes whose weight is all history.+ // Revisions stay out of the ranking so it shares the basis of the areas the treemap draws —+ // asking for one basis and drawing the other would rank in notes the cells then shrink away.const overview = useSpaceUsageFetch<SpaceUsageOverviewResponse>(- `space-usage/overview?limit=${OVERVIEW_LIMIT}&includeRevisions=true`);+ `space-usage/overview?limit=${OVERVIEW_LIMIT}`);return (<div className="space-usage-section">diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/overview.tsx b/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/overview.tsxindex e112b83b17..1a4e32312f 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/overview.tsx+++ b/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/overview.tsx@@ -7,8 +7,14 @@ import { formatSize } from "../../../../../services/utils";import Treemap, { type TreemapItem } from "../../../../react/charts/Treemap";import { bucketWeight, buildOverviewModel, type OverviewCell } from "./overview_model";-/** A cell's area covers a note's whole weight, history included; its tooltip says the same. */-const INCLUDE_REVISIONS = true;+/**+ * A cell's area covers a note's body and attachments, leaving history out; its tooltip says the+ * same. Per-note revision sizes are counted per entity rather than deduplicated, so a revision+ * snapshotting an unchanged body reports its full size while costing the database nothing — folding+ * that into the areas would inflate cells by bytes that were never spent. The status line reports+ * the deduplicated revisions total instead.+ */+const INCLUDE_REVISIONS = false;/** The treemap over the whole database: every large note at its tree location. */export default function Overview({ overview }: { overview: SpaceUsageOverviewResponse }) {