Skip to content

Commit

Permalink
fix: only load ui snippets from local properties
Browse files Browse the repository at this point in the history
  • Loading branch information
moshloop committed Jun 18, 2024
1 parent 7cfbb42 commit 5e808b6
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/hooks/useFlanksourceUISnippet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,8 +31,9 @@ export function useFlanksourceUISnippet(
} catch (error) {
console.error("Error executing snippet", error);
}
} else {
setIsSnippetExecuted(true);
}
}, [featureFlags, user, organization, isSnippetExecuted]);

return null;
}

0 comments on commit 5e808b6

Please sign in to comment.