Skip to content

Commit

Permalink
fix: tooltip and useSWR
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity committed May 24, 2024
1 parent 4228b46 commit 296cfac
Show file tree
Hide file tree
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
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions packages/ui/components/src/FernTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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> = ({
Expand All @@ -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 (
Expand Down

0 comments on commit 296cfac

Please sign in to comment.