From 67dfe8d00c26e68e458b805569a1346295e549de Mon Sep 17 00:00:00 2001 From: Ben White Date: Fri, 20 Dec 2024 10:57:48 +0100 Subject: [PATCH] fix: RemoteConfig legacy site apps (#27093) --- posthog/models/remote_config.py | 2 +- posthog/models/test/test_remote_config.py | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/posthog/models/remote_config.py b/posthog/models/remote_config.py index aa4ed7c59d379..427b3df7ec2de 100644 --- a/posthog/models/remote_config.py +++ b/posthog/models/remote_config.py @@ -261,7 +261,7 @@ def _build_site_apps_js(self): config = get_site_config_from_schema(site_app.config_schema, site_app.config) site_apps_js.append( indent_js( - f"\n{{\n id: '{site_app.token}',\n init: function(config) {{\n {indent_js(site_app.source, indent=4)}().inject({{ config:{json.dumps(config)}, posthog:config.posthog }});\n config.callback();\n }}\n}}" + f"\n{{\n id: '{site_app.token}',\n init: function(config) {{\n {indent_js(site_app.source, indent=4)}().inject({{ config:{json.dumps(config)}, posthog:config.posthog }});\n config.callback(); return {{}} }}\n}}" ) ) site_functions = ( diff --git a/posthog/models/test/test_remote_config.py b/posthog/models/test/test_remote_config.py index 52bfc71821a79..ddcd23aca2a73 100644 --- a/posthog/models/test/test_remote_config.py +++ b/posthog/models/test/test_remote_config.py @@ -541,22 +541,19 @@ def test_renders_js_including_site_apps(self): id: 'tokentoken', init: function(config) { (function () { return { inject: (data) => console.log('injected!', data)}; })().inject({ config:{}, posthog:config.posthog }); - config.callback(); - } + config.callback(); return {} } }, { id: 'tokentoken', init: function(config) { (function () { return { inject: (data) => console.log('injected 2!', data)}; })().inject({ config:{}, posthog:config.posthog }); - config.callback(); - } + config.callback(); return {} } }, { id: 'tokentoken', init: function(config) { (function () { return { inject: (data) => console.log('injected but disabled!', data)}; })().inject({ config:{}, posthog:config.posthog }); - config.callback(); - } + config.callback(); return {} } }] } })();\