fix(docs): handle relative URLs in FernSvgIconServer for local dev #6175
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes FER-
Short description of the changes made
Adds URL handling to
FernSvgIconServerto convert/_local/paths to absolute URLs for server-side fetch operations. The Node.jsfetch()API requires absolute URLs, but in local dev mode (fern docs dev), SVG icon paths like/_local/Users/.../icon.svgare relative.The fix:
/_local/paths to absolute URLs usingNEXT_PUBLIC_FDR_ORIGINWhat was the motivation & context behind this PR?
Custom icons in
fern docs devwere failing with:This caused tabs with custom icons to hang indefinitely. The middleware handles
/_local/paths for browser requests by redirecting to FDR origin, butFernSvgIconServerruns server-side during SSR (React Server Component), bypassing the middleware entirely.Link to Devin run: https://app.devin.ai/sessions/fd7d1417418a4558b5acb0e326031194
Requested by: Catherine Deskur (catherine@buildwithfern.com)
How has this PR been tested?
Not tested locally yet - needs verification with
fern docs devto confirm custom icons load correctly for customers using local file paths.Human review checklist
NEXT_PUBLIC_FDR_ORIGINis always set when/_local/paths are used in local devNEXT_PUBLIC_FDR_ORIGINis not set, the relative URL passes through unchanged, fetch will fail, and it falls back to the Image component - is this acceptable?