From d8023c438201d71c29dd532bf6e2c5ac27b27f95 Mon Sep 17 00:00:00 2001 From: Marius Andra Date: Wed, 20 Nov 2024 16:11:50 +0100 Subject: [PATCH] improve --- .../hogfunctions/HogFunctionConfiguration.tsx | 14 ++++++++------ posthog/api/hog_function.py | 16 +++++++++++----- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/frontend/src/scenes/pipeline/hogfunctions/HogFunctionConfiguration.tsx b/frontend/src/scenes/pipeline/hogfunctions/HogFunctionConfiguration.tsx index 93cffddfa01..b322fb07f34 100644 --- a/frontend/src/scenes/pipeline/hogfunctions/HogFunctionConfiguration.tsx +++ b/frontend/src/scenes/pipeline/hogfunctions/HogFunctionConfiguration.tsx @@ -460,12 +460,14 @@ export function HogFunctionConfiguration({ templateId, id }: HogFunctionConfigur {({ value, onChange }) => ( <> - - This is the underlying Hog code that will run whenever the - filters match.{' '} - See the docs for - more info - + {type !== 'web' ? ( + + This is the underlying Hog code that will run whenever the + filters match.{' '} + See the docs{' '} + for more info + + ) : null} HogFunction: request = self.context["request"] validated_data["created_by"] = request.user - return super().create(validated_data=validated_data) + hog_function = super().create(validated_data=validated_data) + if validated_data.get("type") == "web": + # Re-run the transpilation now that we have an ID + hog_function.transpiled = get_transpiled_function( + str(hog_function.id), hog_function.hog, hog_function.filters, hog_function.inputs, hog_function.team + ) + return hog_function def update(self, instance: HogFunction, validated_data: dict, *args, **kwargs) -> HogFunction: res: HogFunction = super().update(instance, validated_data)