fix(dashboard): resolve Next 16 Webpack node:fs imports and login page unmounted state warning - #13509
fix(dashboard): resolve Next 16 Webpack node:fs imports and login page unmounted state warning#13509joesalaz wants to merge 2 commits into
Conversation
…e unmounted state warning
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical webpack-test and ESM-loading findings, plus an incomplete login unmount guard, block approval.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR addresses Next 16/Node 24 dashboard compatibility, login lifecycle handling, browser-safe Node imports, dependency installation, and release documentation.
Changes:
- Updates login imports and mounted-state guards.
- Adjusts Cursor CLI filesystem handling and Next/Webpack configuration.
- Updates native dependency approvals, lockfile metadata, and changelog.
File summaries
| File | Review summary |
|---|---|
src/app/login/page.tsx |
Moderate (3 votes): Recheck mount state after await res.json(). Nit (3 votes): Add regression coverage for unmount behavior. |
package.json |
Updates dependency and install-script allowlists. |
package-lock.json |
Updates dependency lockfile metadata. |
open-sse/utils/cursorAgentCliVersion.ts |
Critical (3 votes): Bare require is incompatible with ESM and breaks filesystem detection/cache reads. |
next.config.mjs |
Critical (2 votes): The new replacement plugin conflicts with the existing webpack-config test fixture and assertions. |
changelog.d/fixes/13300-next16-node24-webpack-hmr-fixes.md |
Adds the release note for the compatibility fixes. |
Review details
Suppressed comments (1)
src/app/login/page.tsx:105
- The new lifecycle guard is scoped only to
checkAuth; the submit request still callssetErrorin the catch andsetLoading(false)in finally after the page may have been unmounted by HMR or navigation. That leaves the same unmounted-update path inhandleLogin. Share a component-level mounted/abort guard with this handler and guard its setters as well.
} catch (_err) {
setError(t("errorOccurredRetry"));
} finally {
setLoading(false);
}
- Files reviewed: 5/6 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| config.plugins.push( | ||
| new webpack.NormalModuleReplacementPlugin(/^node:(.*)$/, (resource) => { | ||
| resource.request = resource.request.replace(/^node:/, ""); | ||
| }) | ||
| ); |
| nodeFs = require("fs"); | ||
| // eslint-disable-next-line @typescript-eslint/no-require-imports | ||
| nodeOs = require("os"); | ||
| // eslint-disable-next-line @typescript-eslint/no-require-imports | ||
| nodePath = require("path"); |
| if (!isMounted) return; | ||
|
|
||
| if (res.ok) { | ||
| const data = await res.json(); |
| const timer = setTimeout(() => setMounted(true), 0); | ||
| return () => clearTimeout(timer); | ||
| }, []); |
…mount - Guard the node:-prefix NormalModuleReplacementPlugin against test-fixture webpack mocks in next.config.mjs
|
Thanks for digging into this — the underlying node:fs bug you found is real, but there's Triage note: this is the review recommendation — the close itself happens only after the maintainer's per-PR sign-off (and, where a superseding PR is named, after it has landed). Nothing is being closed by this comment. |
|
Thanks for the fix! The |
Fix(dashboard): resolve Next 16 Webpack node:fs imports and login page unmounted state warning
Summary
UnhandledSchemeError: Reading from "node:fs"when client components (ModelSelectModal.tsx) transitively import provider model constants.isMountedguard tosrc/app/login/page.tsxto prevent unmounted state updates during Hot Module Replacement (HMR).better-sqlite3native dependency installation andallowScriptsentries for Node 24 / npm 11.Related Issues
Validation
npm run lint,npm run typecheck:core)npm run lintrelease/v3.8.51); focused checks rerun afterwardTests Added Or Updated
src/app/login/page.tsx(updated withisMountedlifecycle guards)open-sse/utils/cursorAgentCliVersion.ts(wrapped Nodefs/os/pathimports for browser safety)Coverage Notes
src/app/login/page.tsx,open-sse/utils/cursorAgentCliVersion.ts, andnext.config.mjs. All core types and lint gates pass cleanly (npm run lintandnpm run typecheck:coreboth return 0 errors).Reviewer Notes