Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(jump-to-playground): hide button if message parsing will fail (#5048)

Hassieb Pakzadd8d8ab7060d9
diff --git a/web/src/ee/features/playground/page/components/JumpToPlaygroundButton.tsx b/web/src/ee/features/playground/page/components/JumpToPlaygroundButton.tsx
index 499f758317..87f1c076f6 100644
--- a/web/src/ee/features/playground/page/components/JumpToPlaygroundButton.tsx
+++ b/web/src/ee/features/playground/page/components/JumpToPlaygroundButton.tsx
@@ -42,7 +42,8 @@ export const JumpToPlaygroundButton: React.FC<JumpToPlaygroundButtonProps> = (
const projectId = useProjectIdFromURL();
const { setPlaygroundCache } = usePlaygroundCache();
const [capturedState, setCapturedState] = useState<PlaygroundCache>(null);
- const available = useHasEntitlement("playground");
+ const [isAvailable, setIsAvailable] = useState<boolean>(false);
+ const isEntitled = useHasEntitlement("playground");
useEffect(() => {
if (props.source === "prompt") {
@@ -52,12 +53,20 @@ export const JumpToPlaygroundButton: React.FC<JumpToPlaygroundButtonProps> = (
}
}, [props]);
+ useEffect(() => {
+ if (capturedState && isEntitled) {
+ setIsAvailable(true);
+ } else {
+ setIsAvailable(false);
+ }
+ }, [capturedState, isEntitled, setIsAvailable]);
+
const handleClick = () => {
capture(props.analyticsEventName);
setPlaygroundCache(capturedState);
};
- if (!available) return null;
+ if (!isAvailable) return null;
return (
<Button