Skip to content

Commit

Permalink
fix: ssr always true
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity committed Dec 20, 2024
1 parent ea1b424 commit fc0cebb
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 61 deletions.
16 changes: 6 additions & 10 deletions packages/fern-docs/ui/src/api-reference/ApiEndpointPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type * as FernNavigation from "@fern-api/fdr-sdk/navigation";
import { EMPTY_OBJECT } from "@fern-api/ui-core-utils";
import { useSetAtom } from "jotai";
import { useEffect } from "react";
import { ReactNode, useEffect } from "react";
import { useNavigationNodes, useWriteApiDefinitionAtom } from "../atoms";
import { ALL_ENVIRONMENTS_ATOM } from "../atoms/environment";
import { BottomNavigationNeighbors } from "../components/BottomNavigationNeighbors";
Expand All @@ -14,15 +14,11 @@ import {
isApiPackageContentNode,
} from "./ApiPackageContent";

export declare namespace ApiEndpointPage {
export interface Props {
content: DocsContent.ApiEndpointPage;
}
}

export const ApiEndpointPage: React.FC<ApiEndpointPage.Props> = ({
export default function ApiEndpointPage({
content,
}) => {
}: {
content: DocsContent.ApiEndpointPage;
}): ReactNode {
useWriteApiDefinitionAtom(content.apiDefinition);

// TODO: Why are we doing this here?
Expand Down Expand Up @@ -72,4 +68,4 @@ export const ApiEndpointPage: React.FC<ApiEndpointPage.Props> = ({
</div>
</ApiPageContext.Provider>
);
};
}
15 changes: 6 additions & 9 deletions packages/fern-docs/ui/src/api-reference/ApiReferencePage.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ReactNode } from "react";
import {
useIsReady,
useNavigationNodes,
Expand All @@ -8,15 +9,11 @@ import { DocsContent } from "../resolver/DocsContent";
import { BuiltWithFern } from "../sidebar/BuiltWithFern";
import { ApiReferenceContent } from "./ApiReferenceContent";

export declare namespace ApiReferencePage {
export interface Props {
content: DocsContent.ApiReferencePage;
}
}

export const ApiReferencePage: React.FC<ApiReferencePage.Props> = ({
export default function ApiReferencePage({
content,
}) => {
}: {
content: DocsContent.ApiReferencePage;
}): ReactNode {
const hydrated = useIsReady();

useWriteApiDefinitionAtom(content.apiDefinition);
Expand Down Expand Up @@ -49,4 +46,4 @@ export const ApiReferencePage: React.FC<ApiReferencePage.Props> = ({
</div>
</ApiPageContext.Provider>
);
};
}
2 changes: 1 addition & 1 deletion packages/fern-docs/ui/src/changelog/ChangelogEntryPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useHref } from "../hooks/useHref";
import { Markdown } from "../mdx/Markdown";
import { DocsContent } from "../resolver/DocsContent";

export function ChangelogEntryPage({
export default function ChangelogEntryPage({
content,
}: {
content: DocsContent.ChangelogEntryPage;
Expand Down
2 changes: 1 addition & 1 deletion packages/fern-docs/ui/src/changelog/ChangelogPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function getOverviewMdx(
: undefined;
}

export function ChangelogPage({
export default function ChangelogPage({
content,
}: {
content: DocsContent.ChangelogPage;
Expand Down
44 changes: 10 additions & 34 deletions packages/fern-docs/ui/src/docs/DocsMainContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,30 @@ import { useFeatureFlags, useIsReady } from "../atoms";
import { FernErrorBoundary } from "../components/FernErrorBoundary";
import type { DocsContent } from "../resolver/DocsContent";

const MarkdownPage = dynamic(
() => import("./MarkdownPage").then(({ MarkdownPage }) => MarkdownPage),
{
ssr: true,
}
);
const MarkdownPage = dynamic(() => import("./MarkdownPage"), { ssr: true });

const ApiReferencePage = dynamic(
() =>
import("../api-reference/ApiReferencePage").then(
({ ApiReferencePage }) => ApiReferencePage
),
() => import("../api-reference/ApiReferencePage"),
{ ssr: true }
);

const ApiEndpointPage = dynamic(
() =>
import("../api-reference/ApiEndpointPage").then(
({ ApiEndpointPage }) => ApiEndpointPage
),
() => import("../api-reference/ApiEndpointPage"),
{ ssr: true }
);

const ChangelogPage = dynamic(
() =>
import("../changelog/ChangelogPage").then(
({ ChangelogPage }) => ChangelogPage
),
{
ssr: true,
}
);
const ChangelogPage = dynamic(() => import("../changelog/ChangelogPage"), {
ssr: true,
});

const ChangelogEntryPage = dynamic(
() =>
import("../changelog/ChangelogEntryPage").then(
({ ChangelogEntryPage }) => ChangelogEntryPage
),
() => import("../changelog/ChangelogEntryPage"),
{ ssr: true }
);

const FeedbackPopover = dynamic(
() =>
import("../feedback/FeedbackPopover").then(
({ FeedbackPopover }) => FeedbackPopover
),
{ ssr: false }
);
const FeedbackPopover = dynamic(() => import("../feedback/FeedbackPopover"), {
ssr: true,
});

const DocsMainContentRenderer = memo(
({ content }: { content: DocsContent }) => {
Expand Down
10 changes: 5 additions & 5 deletions packages/fern-docs/ui/src/docs/MarkdownPage.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ReactElement } from "react";
import { ReactNode } from "react";
import { useWriteApiDefinitionsAtom } from "../atoms";
import { LayoutEvaluator } from "../layouts/LayoutEvaluator";
import { DocsContent } from "../resolver/DocsContent";

interface MarkdownPageProps {
export default function MarkdownPage({
content,
}: {
content: DocsContent.MarkdownPage;
}

export function MarkdownPage({ content }: MarkdownPageProps): ReactElement {
}): ReactNode {
useWriteApiDefinitionsAtom(content.apis);
return <LayoutEvaluator {...content} />;
}
4 changes: 3 additions & 1 deletion packages/fern-docs/ui/src/feedback/FeedbackPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ type SelectionTextToolbarProps = {
// );
// };

export const FeedbackPopover = forwardRef<
const FeedbackPopover = forwardRef<
SelectionTextToolbarElement,
SelectionTextToolbarProps
>(({ children }, forwardedRef) => {
Expand Down Expand Up @@ -249,3 +249,5 @@ export const FeedbackPopover = forwardRef<
});

FeedbackPopover.displayName = "FeedbackPopover";

export default FeedbackPopover;

0 comments on commit fc0cebb

Please sign in to comment.