Skip to content

Commit

Permalink
fix: tooltip not working and useSWR broken (#924)
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity authored May 24, 2024
1 parent 1f7842f commit b1b04a0
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 6 additions & 1 deletion packages/ui/app/src/api-playground/PlaygroundContext.tsx
Original file line number Diff line number Diff line change
@@ -50,6 +50,11 @@ export const PLAYGROUND_FORM_STATE_ATOM = atomWithStorage<Record<string, Playgro
{},
);

const fetcher = async (url: string) => {
const res = await fetch(url);
return res.json();
};

export const PlaygroundContextProvider: FC<PropsWithChildren> = ({ children }) => {
const { isApiPlaygroundEnabled } = useFeatureFlags();
const [apis, setApis] = useAtom(APIS);
@@ -58,7 +63,7 @@ export const PlaygroundContextProvider: FC<PropsWithChildren> = ({ children }) =

const key = urljoin(basePath ?? "", "/api/fern-docs/resolve-api");

const { data } = useSWR<Record<string, ResolvedRootPackage> | null>(key);
const { data } = useSWR<Record<string, ResolvedRootPackage> | null>(key, fetcher);
useEffect(() => {
if (data != null) {
setApis(data);
4 changes: 1 addition & 3 deletions packages/ui/components/src/FernTooltip.tsx
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@ import { FC, ReactNode } from "react";

interface FernTooltipProps extends Tooltip.TooltipProps, Omit<Tooltip.TooltipContentProps, "content"> {
content: ReactNode | undefined;
isReady?: boolean;
}

export const FernTooltip: FC<FernTooltipProps> = ({
@@ -15,10 +14,9 @@ export const FernTooltip: FC<FernTooltipProps> = ({
onOpenChange,
delayDuration,
disableHoverableContent,
isReady,
...props
}) => {
if (content == null || content === "" || !isReady) {
if (content == null || content === "") {
return <>{children}</>;
}
return (

0 comments on commit b1b04a0

Please sign in to comment.