Skip to content

chore: upgrade react-markdown to 9.1.0 so it stops warning about defaultProps (LAZ-1698) - #24963

Open
ecemooo wants to merge 7 commits into
masterfrom
laz-1698-markdown
Open

ecemooo wants to merge 7 commits into
masterfrom
laz-1698-markdown

Conversation

@ecemooo

@ecemooo ecemooo commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

https://linear.app/nexus-mods/issue/LAZ-1698/clear-the-react-deprecation-warnings-out-of-the-renderer-tests

Summary

Upgrades react-markdown from 6 to 9, so it stops logging a React deprecation warning (defaultProps) in our tests. Markdown looks the same to users, apart from the link and image changes below.

  • react-markdown 9 can't be imported directly by the renderer, so a small file (util/react_markdown/ReactMarkdown.tsx) loads it, and everything imports it from there. A lint rule stops direct imports.
  • That file only lets a link go to a web page or an email address, whatever renders it, and links render with WebLink by default.
  • Tests now fail on a defaultProps warning, from function or memo components, so it can't come back.

Evidence

  • Before: 44 React warnings in the renderer tests, 6 of them defaultProps.
    After: 38 warnings, no defaultProps. All tests pass.
  • Tested live in a dev build (Linux):
Scenario This PR
Markdown dialog: steam:, relative, //share, tel: links No target; clicking does nothing, no reload
Markdown dialog: data: image and //share image data: shows; network-share image has no src
About page GPL-3 text http://fsf.org/ is plain text, not a link
Extension require("react-markdown") with linkTarget, transformImageUri Renders; image rewritten; both logged as deprecated

Why 9, not 10: 9.1.0 still supports className, which v10 removes, so the six className= call sites keep working unchanged.

What changes for links and images

  • App links (steam:, nxm:, file:) do nothing when clicked, as in 6. Without the fix, 9 gave them href="", which reloads the whole window.
  • Relative and network links (../run.exe, //server/share/run.exe) no longer open. Before, they resolved against the app's file:// page and opened through the shell. This affects extension dialogs, More, LOOT messages and the bundled issue-tracker and changelog dashlet.
  • tel: links no longer open. Links only keep http(s) and mailto: targets, even with a caller's own a or urlTransform.
  • Link titles ([x](url "Title")) no longer show as hover text.
  • License text on the About page is no longer clickable. disallowedElements named link before, which matches nothing.
  • Images keep their source as in 6, except ones from a network share (//host/…, file://host/…), which no longer load.

Extension authors

require("react-markdown") from an extension now gets a Vortex-provided component that is also its own .default, and carries 9's other exports and 6's uriTransformer. Every way of importing 6 still works: require, import ReactMarkdown from, import * as and import =. Its links and images are filtered as above.

transformLinkUri and transformImageUri still run, through urlTransform. The other props 9 dropped, including the ones 6 had already deprecated (renderers, source, plugins, …), are ignored. All of them are logged as deprecated API use. Remark or rehype plugins made for 6 that throw under 9 are dropped and reported, so the markdown still renders.

This is in packages/vortex-api/CHANGELOG.md, and in a new react-markdown section in packages/vortex-api/docs/MIGRATION.md.

Merge Danger

Door: two-way. Reverting brings back the old version and its warning.

Blast Radius: markdown. Anywhere Vortex or an extension shows markdown (dialogs, About page, collection instructions, plugin list, extension UIs) uses the new version.

@github-actions

Copy link
Copy Markdown

This PR has conflicts. You need to rebase the PR before it can be merged.

@ecemooo ecemooo self-assigned this Nov 19, 2026
@github-actions

Copy link
Copy Markdown

This PR doesn't have conflicts anymore. It can be merged after all status checks have passed and it has been reviewed.

@ecemooo
ecemooo marked this pull request as ready for review November 19, 2026 12:02
@ecemooo
ecemooo requested a review from a team as a code owner November 19, 2026 12:02
Comment thread pnpm-workspace.yaml Resolved
Comment thread pnpm-workspace.yaml Resolved
Comment thread src/renderer/src/views/Dialog.tsx Resolved
Comment thread src/renderer/test-setup.mts Resolved
@github-actions

Copy link
Copy Markdown

This PR has conflicts. You need to rebase the PR before it can be merged.

@github-actions

Copy link
Copy Markdown

This PR doesn't have conflicts anymore. It can be merged after all status checks have passed and it has been reviewed.

@ecemooo
ecemooo requested a review from r1chm8 November 19, 2026 13:35
@ecemooo
ecemooo requested a review from r1chm8 November 19, 2026 14:40
@ecemooo
ecemooo requested a review from r1chm8 November 19, 2026 16:22

@r1chm8 r1chm8 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for working through all of these. I'm treating this as the last round: the two comments below are the only blockers, and I'll approve once they're in without doing another full review. Anything else I spot from here goes into a follow-up ticket rather than this PR.

if (["http:", "https:", "data:"].includes(url.protocol)) {
return src;
}
return url.protocol === "file:" && url.host === "" ? src : undefined;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This still lets network-share images through in one form. file:////host/share/x.png and the relative ////host/share/x.png both parse with host === "" and pathname //host/share/x.png, so they pass this check and the original src goes through unchanged. Chromium on Windows reads file:////server/share as the UNC path \\server\share, so the image would still open an SMB connection, which is the case this is meant to block.

Could we also drop anything whose pathname starts with // (and the backslash forms)? Please add both forms to the tests, and check them on Windows if you can, since I haven't been able to confirm the UNC behaviour there.

if (url === null || url === undefined) {
return undefined;
}
return key === "src" ? imageSrc(url) : (webHref(url) ?? mailHref(url));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

An extension's own components.a or components.img can now get href or src as undefined. Under 6 these were always strings, so a custom a that does href.startsWith("http") or new URL(href) now throws on [see below](#section), a relative link or steam:, and the extension's UI unmounts.

Could custom components get "" instead (keeping undefined for WebLink), or, if we'd rather keep undefined, add it to the react-markdown section of MIGRATION.md and the CHANGELOG entry? It isn't in either at the moment.

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.

2 participants