From 9a0429ad1e7a4e1ca1f1a069035ff490fed8ca51 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Tue, 14 Jan 2025 15:22:20 +0530 Subject: [PATCH] perf: Skip one dump + load on boot.json (#29153) Since we are json.dumping it, there's no point in sanitizing using SCRIPT_TAG_PATTERN. This removes dumb json dump + load + dump. --- frappe/www/app.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/frappe/www/app.py b/frappe/www/app.py index b347872c84..4414b5a849 100644 --- a/frappe/www/app.py +++ b/frappe/www/app.py @@ -36,14 +36,6 @@ def get_context(context): frappe.db.commit() - boot_json = frappe.as_json(boot, indent=None, separators=(",", ":")) - - # remove script tags from boot - boot_json = SCRIPT_TAG_PATTERN.sub("", boot_json) - - # TODO: Find better fix - boot_json = CLOSING_SCRIPT_TAG_PATTERN.sub("", boot_json) - hooks = frappe.get_hooks() app_include_js = hooks.get("app_include_js", []) + frappe.conf.get("app_include_js", []) app_include_css = hooks.get("app_include_css", []) + frappe.conf.get("app_include_css", []) @@ -62,7 +54,7 @@ def get_context(context): "layout_direction": "rtl" if is_rtl() else "ltr", "lang": frappe.local.lang, "sounds": hooks["sounds"], - "boot": boot if context.get("for_mobile") else json.loads(boot_json), + "boot": boot, "desk_theme": boot.get("desk_theme") or "Light", "csrf_token": csrf_token, "google_analytics_id": frappe.conf.get("google_analytics_id"),