From 5e808b6020493380ed30058f3e142ec6dc2578ee Mon Sep 17 00:00:00 2001 From: Moshe Immerman Date: Tue, 18 Jun 2024 16:44:33 +0300 Subject: [PATCH] fix: only load ui snippets from local properties --- src/hooks/useFlanksourceUISnippet.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/hooks/useFlanksourceUISnippet.tsx b/src/hooks/useFlanksourceUISnippet.tsx index d78ecc464..6f8e2cd79 100644 --- a/src/hooks/useFlanksourceUISnippet.tsx +++ b/src/hooks/useFlanksourceUISnippet.tsx @@ -14,14 +14,9 @@ export function useFlanksourceUISnippet( return; } const snippets = featureFlags?.find((flag) => { - return flag.name === "flanksource.ui.snippets"; + return flag.name === "flanksource.ui.snippets" && flag.name === "local"; }); - if (snippets?.source !== "local") { - console.warn("UI snippets can only be set at start time."); - return; - } - if (snippets && user) { try { // We need to wrap the snippet in a function to be able to pass in named @@ -36,8 +31,9 @@ export function useFlanksourceUISnippet( } catch (error) { console.error("Error executing snippet", error); } + } else { + setIsSnippetExecuted(true); } }, [featureFlags, user, organization, isSnippetExecuted]); - return null; }