MCPcopy Create free account
hub / github.com/block/buzz / usePreviewFeatureWarning

Function usePreviewFeatureWarning

desktop/src/shared/features/useFeatureEnabled.ts:140–159  ·  view source on GitHub ↗
(featureId: string)

Source from the content-addressed store, hash-verified

138 * Stays a no-op for stable features and for preview features that ARE enabled.
139 */
140export function usePreviewFeatureWarning(featureId: string): void {
141 const enabled = useFeatureEnabled(featureId);
142 const feature = getFeature(featureId);
143
144 useEffect(() => {
145 // No-op for stable features (not in manifest) and preview features
146 // that ARE enabled. Manifest membership = preview by definition.
147 if (!feature || enabled) return;
148 let cancelled = false;
149 void import("sonner").then(({ toast }) => {
150 if (cancelled) return;
151 toast.warning(
152 `${feature.name} is a preview feature. Enable it in Settings → Experiments to surface it in your sidebar.`,
153 );
154 });
155 return () => {
156 cancelled = true;
157 };
158 }, [feature, enabled]);
159}
160
161export { resolveEnabled } from "./resolveEnabled";

Callers 6

ProjectsRouteComponentFunction · 0.90
WorkflowsRouteComponentFunction · 0.90
PulseRouteComponentFunction · 0.90
ForumPostRouteComponentFunction · 0.90

Calls 2

getFeatureFunction · 0.90
useFeatureEnabledFunction · 0.85

Tested by

no test coverage detected