@pdfme/ui 6.0.6-dev.11 → 6.0.6-dev.13

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/index.js CHANGED
@@ -10012,11 +10012,18 @@ var getDynamicTemplate = async (arg) => {
10012
10012
  };
10013
10013
  };
10014
10014
  var expressionCache = /* @__PURE__ */ new Map();
10015
- var parseDataCache = /* @__PURE__ */ new Map();
10015
+ /**
10016
+ * Parse each string value in `data` as JSON, falling back to the original
10017
+ * string on failure. Previously memoized via a module-level `parseDataCache`
10018
+ * Map keyed by `JSON.stringify(data)`, but that was a severe memory leak:
10019
+ * - Cache was never evicted.
10020
+ * - Key was a multi-MB string whenever `data` included schema.content with
10021
+ * base64 (e.g. image schemas) or inputs containing base64 values. Every
10022
+ * unique inputs state pinned its own multi-MB key for the app lifetime.
10023
+ * Parsing is O(fields) and cheap; removing the cache is strictly a win.
10024
+ */
10016
10025
  var parseData = (data) => {
10017
- const key = JSON.stringify(data);
10018
- if (parseDataCache.has(key)) return parseDataCache.get(key);
10019
- const parsed = Object.fromEntries(Object.entries(data).map(([key, value]) => {
10026
+ return Object.fromEntries(Object.entries(data).map(([key, value]) => {
10020
10027
  if (typeof value === "string") try {
10021
10028
  return [key, JSON.parse(value)];
10022
10029
  } catch {
@@ -10024,8 +10031,6 @@ var parseData = (data) => {
10024
10031
  }
10025
10032
  return [key, value];
10026
10033
  }));
10027
- parseDataCache.set(key, parsed);
10028
- return parsed;
10029
10034
  };
10030
10035
  var padZero = (num) => String(num).padStart(2, "0");
10031
10036
  var formatDate = (date) => `${date.getFullYear()}/${padZero(date.getMonth() + 1)}/${padZero(date.getDate())}`;