Skip to content

Conversation

@sbawabe
Copy link
Collaborator

@sbawabe sbawabe commented Oct 31, 2025

Fixes FER-7344

Short description of the changes made

What was the motivation & context behind this PR?

How has this PR been tested?

@vercel
Copy link
Contributor

vercel bot commented Oct 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
fern-dashboard Ready Ready Preview Nov 4, 2025 4:41pm
fern-dashboard-dev Ready Ready Preview Nov 4, 2025 4:41pm
ferndocs.com Ready Ready Preview Nov 4, 2025 4:41pm
preview.ferndocs.com Ready Ready Preview Nov 4, 2025 4:41pm
prod-assets.ferndocs.com Ready Ready Preview Nov 4, 2025 4:41pm
prod.ferndocs.com Ready Ready Preview Nov 4, 2025 4:41pm
2 Skipped Deployments
Project Deployment Preview Updated (UTC)
dev.ferndocs.com Ignored Ignored Preview Nov 4, 2025 4:41pm
fern-platform Ignored Ignored Nov 4, 2025 4:41pm

@vercel vercel bot temporarily deployed to Preview – prod.ferndocs.com October 31, 2025 20:27 Inactive
@vercel vercel bot temporarily deployed to Preview – prod-assets.ferndocs.com October 31, 2025 20:27 Inactive
@vercel vercel bot temporarily deployed to Preview – preview.ferndocs.com October 31, 2025 20:27 Inactive
Copy link
Collaborator Author

sbawabe commented Oct 31, 2025

@sbawabe sbawabe force-pushed the 10-31-fix_dashboard_begin_caching_calls_and_moving_reused_functions_to_server_actions branch from 141159e to fbdf387 Compare November 3, 2025 17:53
@sbawabe sbawabe force-pushed the 10-31-fix_dashboard_latency_work branch from 45fb737 to ac6000f Compare November 3, 2025 17:53
@vercel vercel bot temporarily deployed to Preview – prod.ferndocs.com November 3, 2025 18:07 Inactive
@vercel vercel bot temporarily deployed to Preview – prod-assets.ferndocs.com November 3, 2025 18:07 Inactive
@vercel vercel bot temporarily deployed to Preview – preview.ferndocs.com November 3, 2025 18:07 Inactive
Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestion:

The getFernVersionUpdateInfo function signature has been changed to accept three positional parameters instead of a single object, but this call site still uses the old object syntax.

View Details
📝 Patch Details
diff --git a/packages/fern-dashboard/src/components/docs-page/visual-editor-section/CriticalUpdateWarning.tsx b/packages/fern-dashboard/src/components/docs-page/visual-editor-section/CriticalUpdateWarning.tsx
index d5a72d522..95da90dd8 100644
--- a/packages/fern-dashboard/src/components/docs-page/visual-editor-section/CriticalUpdateWarning.tsx
+++ b/packages/fern-dashboard/src/components/docs-page/visual-editor-section/CriticalUpdateWarning.tsx
@@ -16,11 +16,7 @@ export async function CriticalUpdateWarning({
     githubUrl: string;
     baseBranch: string;
 }) {
-    const fernVersionInfoResult = await getFernVersionUpdateInfo({
-        githubUrl,
-        docsUrl,
-        baseBranch
-    });
+    const fernVersionInfoResult = await getFernVersionUpdateInfo(githubUrl, docsUrl, baseBranch);
 
     const fernVersionInfo = fernVersionInfoResult.ok ? fernVersionInfoResult.result : undefined;
 

Analysis

Function call uses outdated object syntax instead of positional parameters

What fails: getFernVersionUpdateInfo() call in CriticalUpdateWarning.tsx uses object destructuring syntax, but function now expects 3 positional parameters

How to reproduce:

cd packages/fern-dashboard && pnpm run typecheck

Result: TypeScript error: src/components/docs-page/visual-editor-section/CriticalUpdateWarning.tsx(19,41): error TS2554: Expected 3 arguments, but got 1.

Expected: Function should be called with positional parameters: getFernVersionUpdateInfo(githubUrl, docsUrl, baseBranch) matching the updated signature in getFernVersionUpdateInfo.ts

if (githubUrl == null || baseBranch == null || docsUrl == null) {
return { ok: false, error: { type: "MALFORMED_INPUT" } };
}
import { cache } from "react";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import { cache } from "react" statement is placed after type exports instead of at the top with other imports, violating TypeScript import conventions.

View Details
📝 Patch Details
diff --git a/packages/fern-dashboard/src/app/services/dal/github/getFernVersionUpdateInfo.ts b/packages/fern-dashboard/src/app/services/dal/github/getFernVersionUpdateInfo.ts
index eb5ea3e7f..cd4a449bf 100644
--- a/packages/fern-dashboard/src/app/services/dal/github/getFernVersionUpdateInfo.ts
+++ b/packages/fern-dashboard/src/app/services/dal/github/getFernVersionUpdateInfo.ts
@@ -1,67 +1,88 @@
 import "server-only";
 
-import { compareVersions, getLatestFernCliVersion, MIN_VE_CLI_VERSION } from "@/utils/fernCliVersion";
+import { cache } from "react";
+
+import {
+  MIN_VE_CLI_VERSION,
+  compareVersions,
+  getLatestFernCliVersion,
+} from "@/utils/fernCliVersion";
 import type { DocsUrl } from "@/utils/types";
 
 import { checkUpgradePrStatus } from "./checkUpgradePrStatus";
-import { type GetFernVersionFromRepoError, getFernVersionFromRepo } from "./getFernVersionFromRepo";
+import {
+  type GetFernVersionFromRepoError,
+  getFernVersionFromRepo,
+} from "./getFernVersionFromRepo";
 
 export type GetFernVersionUpdateInfoResult = {
-    current: string;
-    latest: string;
-    needsUpgrade: boolean;
-    isBelowMinimum: boolean;
-    existingPr?: {
-        exists: boolean;
-        prUrl?: string;
-        prNumber?: number;
-    };
+  current: string;
+  latest: string;
+  needsUpgrade: boolean;
+  isBelowMinimum: boolean;
+  existingPr?: {
+    exists: boolean;
+    prUrl?: string;
+    prNumber?: number;
+  };
 };
 
-export type GetFernVersionUpdateInfoError = GetFernVersionFromRepoError | { type: "MALFORMED_INPUT" };
-
-import { cache } from "react";
+export type GetFernVersionUpdateInfoError =
+  | GetFernVersionFromRepoError
+  | { type: "MALFORMED_INPUT" };
 
 export const getFernVersionUpdateInfo = cache(
-    async (
-        githubUrl: string,
-        docsUrl: DocsUrl,
-        baseBranch: string
-    ): Promise<
-        { ok: true; result: GetFernVersionUpdateInfoResult } | { ok: false; error: GetFernVersionUpdateInfoError }
-    > => {
-        if (githubUrl == null || baseBranch == null || docsUrl == null) {
-            return { ok: false, error: { type: "MALFORMED_INPUT" } };
-        }
+  async (
+    githubUrl: string,
+    docsUrl: DocsUrl,
+    baseBranch: string
+  ): Promise<
+    | { ok: true; result: GetFernVersionUpdateInfoResult }
+    | { ok: false; error: GetFernVersionUpdateInfoError }
+  > => {
+    if (githubUrl == null || baseBranch == null || docsUrl == null) {
+      return { ok: false, error: { type: "MALFORMED_INPUT" } };
+    }
 
-        const [fernVersionResult, latestVersion] = await Promise.all([
-            getFernVersionFromRepo(githubUrl, docsUrl),
-            getLatestFernCliVersion()
-        ]);
+    const [fernVersionResult, latestVersion] = await Promise.all([
+      getFernVersionFromRepo(githubUrl, docsUrl),
+      getLatestFernCliVersion(),
+    ]);
 
-        if (!fernVersionResult.ok) {
-            return { ok: false, error: fernVersionResult.error };
-        }
+    if (!fernVersionResult.ok) {
+      return { ok: false, error: fernVersionResult.error };
+    }
 
-        const needsUpgrade = compareVersions(fernVersionResult.version, latestVersion);
-        const isBelowMinimum = compareVersions(fernVersionResult.version, MIN_VE_CLI_VERSION);
+    const needsUpgrade = compareVersions(
+      fernVersionResult.version,
+      latestVersion
+    );
+    const isBelowMinimum = compareVersions(
+      fernVersionResult.version,
+      MIN_VE_CLI_VERSION
+    );
 
-        let existingPr;
+    let existingPr;
 
-        // Show version info if any update is available
-        if (needsUpgrade) {
-            // Check if there's already an existing upgrade PR
-            existingPr = await checkUpgradePrStatus(githubUrl, fernVersionResult.version, latestVersion, baseBranch);
-        }
-        return {
-            ok: true,
-            result: {
-                current: fernVersionResult.version,
-                latest: latestVersion,
-                needsUpgrade,
-                isBelowMinimum,
-                existingPr
-            }
-        };
+    // Show version info if any update is available
+    if (needsUpgrade) {
+      // Check if there's already an existing upgrade PR
+      existingPr = await checkUpgradePrStatus(
+        githubUrl,
+        fernVersionResult.version,
+        latestVersion,
+        baseBranch
+      );
     }
+    return {
+      ok: true,
+      result: {
+        current: fernVersionResult.version,
+        latest: latestVersion,
+        needsUpgrade,
+        isBelowMinimum,
+        existingPr,
+      },
+    };
+  }
 );

Analysis

Import statement placed after exports violates Prettier formatting rules in getFernVersionUpdateInfo.ts

What fails: import { cache } from "react" is placed after type exports instead of with other imports, violating the project's Prettier import sorting configuration

How to reproduce:

cd packages/fern-dashboard
pnpm exec prettier --check src/app/services/dal/github/getFernVersionUpdateInfo.ts

Result: Prettier reports "Code style issues found" due to React import being placed after exports instead of in proper import group order

Expected: React imports should be grouped near the top per the project's .prettierrc.json import ordering rules: ["server-only", "^(react*|next*)", "<THIRD_PARTY_MODULES>", ...]

Copy link
Collaborator Author

sbawabe commented Nov 4, 2025

Merge activity

  • Nov 4, 4:32 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Nov 4, 4:34 PM UTC: Graphite rebased this pull request as part of a merge.
  • Nov 4, 4:36 PM UTC: @sbawabe merged this pull request with Graphite.

@sbawabe sbawabe changed the base branch from 10-31-fix_dashboard_latency_work to graphite-base/4654 November 4, 2025 16:32
@sbawabe sbawabe changed the base branch from graphite-base/4654 to app November 4, 2025 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants