Skip to content

Commit

Permalink
fix: RemoteConfig legacy site apps (#27093)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjackwhite authored Dec 20, 2024
1 parent f203ab5 commit 67dfe8d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion posthog/models/remote_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down
9 changes: 3 additions & 6 deletions posthog/models/test/test_remote_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 {} }
}]
}
})();\
Expand Down

0 comments on commit 67dfe8d

Please sign in to comment.