one react-resizable-panels, and honest metadata for the peers
Two dependency problems, and only one of them was real. ── Real: two majors of the same library ── The root asked for `react-resizable-panels@^4.0.15` (4.6.5) while `src/workspaces/components` asked for `^2.1.7` (2.1.9). The workspace code targets 2.x, whose API differs — v4 has no `PanelGroup` export, no `order` prop and no `ref` on `Panel` — so a file that resolved the root's copy failed to typecheck in a way that read like a broken extraction. Nothing imported the root's version. It was vestigial, and removing it collapses the repository to one: every importer now resolves 2.1.9 and the lockfile has zero v4 entries. ── Not real: the second React ── Declaring react/react-dom in the package created `src/workspaces/workspaces/node_modules/react`, which looks exactly like the duplicate-instance bug that silently breaks hooks. It is not one. Both locations resolve to the SAME file in bun's store — the local entry is a symlink — which I established by resolving the specifier from each place instead of reading directory names, having already reported it as a hazard on the strength of an `ls`. Declared as optional peers regardless: that is the right metadata for a consumer, and it stops bun installing peers it does not need to. Notes corrected to match, since the wrong version of that story was written down. tsgo clean, package 114/114, full suite 950 pass / 7 fail unchanged, frontend builds. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+14
-9
@@ -38,17 +38,22 @@ nothing.
|
||||
|
||||
## Two traps, both worth knowing before touching dependencies
|
||||
|
||||
**A second React.** Declaring `react`/`react-dom` in the package produced a second copy under
|
||||
`src/workspaces/workspaces/node_modules`. Two React instances break hooks at runtime and are invisible
|
||||
until something renders. While this lives in the monorepo the package declares almost nothing and inherits
|
||||
the root's; publishing standalone means declaring them as peers, aligned with the host.
|
||||
**A second React — which turned out not to be one.** Declaring `react`/`react-dom` created
|
||||
`src/workspaces/workspaces/node_modules/react`, and a directory of that name looks exactly like the
|
||||
duplicate-instance bug that breaks hooks. It was not: both locations RESOLVE to the same file in bun's
|
||||
store (`.bun/react@19.2.4/…/react/index.js`), because the local entry is a symlink. Checked by resolving
|
||||
the specifier from both places rather than by reading directory names.
|
||||
|
||||
**Two versions of `react-resizable-panels`.** The root asks for `^4.0.15` (4.6.5); `src/workspaces/components`
|
||||
asks for `^2.1.7` (2.1.9). This code was written against 2.x, whose API differs — v4 has no `PanelGroup`
|
||||
export, no `order` prop, no `ref` on `Panel`. Inheriting the root's resolution produced dozens of type
|
||||
errors that read like a broken extraction and were a version mismatch. The package pins `^2.1.7`.
|
||||
They are declared as `peerDependencies` with `peerDependenciesMeta.optional` anyway — correct metadata for
|
||||
a consumer, and it keeps bun from installing peers it does not need to.
|
||||
|
||||
Worth resolving properly at some point: one repository, two majors of the same library.
|
||||
**Two versions of `react-resizable-panels` — real, and now fixed.** The root asked for `^4.0.15` (4.6.5)
|
||||
while `src/workspaces/components` asked for `^2.1.7` (2.1.9), and this code targets 2.x, whose API differs
|
||||
(v4 has no `PanelGroup` export, no `order` prop, no `ref` on `Panel`). Inheriting the root's resolution
|
||||
produced a screenful of type errors that read like a broken extraction.
|
||||
|
||||
Nothing imported the root's copy — it was vestigial. Removed, so the repository now carries one version and
|
||||
the lockfile has zero v4 entries.
|
||||
|
||||
## Open
|
||||
|
||||
|
||||
@@ -114,7 +114,6 @@
|
||||
"react-dom": "^19",
|
||||
"react-hook-form": "^7.69.0",
|
||||
"react-markdown": "^10.1.0",
|
||||
"react-resizable-panels": "^4.0.15",
|
||||
"react-router": "^7.11.0",
|
||||
"react-spinners": "^0.17.0",
|
||||
"recharts": "3.6.0",
|
||||
@@ -305,6 +304,14 @@
|
||||
"dependencies": {
|
||||
"react-resizable-panels": "^2.1.7",
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=18",
|
||||
"react-dom": ">=18",
|
||||
},
|
||||
"optionalPeers": [
|
||||
"react",
|
||||
"react-dom",
|
||||
],
|
||||
},
|
||||
},
|
||||
"packages": {
|
||||
@@ -2030,7 +2037,7 @@
|
||||
|
||||
"react-remove-scroll-bar": ["react-remove-scroll-bar@2.3.8", "", { "dependencies": { "react-style-singleton": "^2.2.2", "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-9r+yi9+mgU33AKcj6IbT9oRCO78WriSj6t/cF8DWBZJ9aOGPOTEDvdUDz1FwKim7QXWwmHqtdHnRJfhAxEG46Q=="],
|
||||
|
||||
"react-resizable-panels": ["react-resizable-panels@4.6.5", "", { "peerDependencies": { "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" } }, "sha512-pmQP6qv9KmsesNMvWVNvVfVJAwYSOWWbAOAtrPR8Cre20+j1NWIlyft0btjtDQE+OepXmI6g3VPrCXQY0oD7+Q=="],
|
||||
"react-resizable-panels": ["react-resizable-panels@2.1.9", "", { "peerDependencies": { "react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc", "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" } }, "sha512-z77+X08YDIrgAes4jl8xhnUu1LNIRp4+E7cv4xHmLOxxUPO/ML7PSrE813b90vj7xvQ1lcf7g2uA9GeMZonjhQ=="],
|
||||
|
||||
"react-router": ["react-router@7.13.1", "", { "dependencies": { "cookie": "^1.0.1", "set-cookie-parser": "^2.6.0" }, "peerDependencies": { "react": ">=18", "react-dom": ">=18" }, "optionalPeers": ["react-dom"] }, "sha512-td+xP4X2/6BJvZoX6xw++A2DdEi++YypA69bJUV5oVvqf6/9/9nNlD70YO1e9d3MyamJEBQFEzk6mbfDYbqrSA=="],
|
||||
|
||||
@@ -2500,8 +2507,6 @@
|
||||
|
||||
"components/lucide-react": ["lucide-react@0.468.0", "", { "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0-rc" } }, "sha512-6koYRhnM2N0GGZIdXzSeiNwguv1gt/FAjZOiPl76roBi3xKEXa4WmfpxgQwTTL4KipXjefrnf3oV4IsYhi4JFA=="],
|
||||
|
||||
"components/react-resizable-panels": ["react-resizable-panels@2.1.9", "", { "peerDependencies": { "react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc", "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" } }, "sha512-z77+X08YDIrgAes4jl8xhnUu1LNIRp4+E7cv4xHmLOxxUPO/ML7PSrE813b90vj7xvQ1lcf7g2uA9GeMZonjhQ=="],
|
||||
|
||||
"components/sonner": ["sonner@1.7.4", "", { "peerDependencies": { "react": "^18.0.0 || ^19.0.0 || ^19.0.0-rc", "react-dom": "^18.0.0 || ^19.0.0 || ^19.0.0-rc" } }, "sha512-DIS8z4PfJRbIyfVFDVnK9rO3eYDtse4Omcm6bt0oEr5/jtLgysmjuBl1frJ9E/EQZrFmKx2A8m/s5s9CRXIzhw=="],
|
||||
|
||||
"components/tailwind-merge": ["tailwind-merge@2.6.1", "", {}, "sha512-Oo6tHdpZsGpkKG88HJ8RR1rg/RdnEkQEfMoEk2x1XRI3F1AxeU+ijRXpiVUF4UbLfcxxRGw6TbUINKYdWVsQTQ=="],
|
||||
@@ -2650,8 +2655,6 @@
|
||||
|
||||
"wif/bs58check": ["bs58check@4.0.0", "", { "dependencies": { "@noble/hashes": "^1.2.0", "bs58": "^6.0.0" } }, "sha512-FsGDOnFg9aVI9erdriULkd/JjEWONV/lQE5aYziB5PoBsXRind56lh8doIZIc9X4HoxT5x4bLjMWN1/NB8Zp5g=="],
|
||||
|
||||
"workspaces/react-resizable-panels": ["react-resizable-panels@2.1.9", "", { "peerDependencies": { "react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc", "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" } }, "sha512-z77+X08YDIrgAes4jl8xhnUu1LNIRp4+E7cv4xHmLOxxUPO/ML7PSrE813b90vj7xvQ1lcf7g2uA9GeMZonjhQ=="],
|
||||
|
||||
"wrap-ansi/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
|
||||
|
||||
"wrap-ansi-cjs/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
|
||||
|
||||
@@ -137,7 +137,6 @@
|
||||
"react-dom": "^19",
|
||||
"react-hook-form": "^7.69.0",
|
||||
"react-markdown": "^10.1.0",
|
||||
"react-resizable-panels": "^4.0.15",
|
||||
"react-router": "^7.11.0",
|
||||
"react-spinners": "^0.17.0",
|
||||
"recharts": "3.6.0",
|
||||
|
||||
@@ -9,8 +9,20 @@
|
||||
"./core": "./src/core/index.ts",
|
||||
"./react": "./src/react/index.ts"
|
||||
},
|
||||
"_dependencies_note": "Only the one that had to be pinned. This repository carries TWO versions of react-resizable-panels \u2014 the root asks for ^4.0.15 (4.6.5) and src/workspaces/components for ^2.1.7 (2.1.9) \u2014 and this code was written against 2.x, whose API differs: v4 has no PanelGroup export, no `order` prop and no `ref` on Panel. Inheriting the root resolution produced dozens of type errors that looked like a broken extraction and were a version mismatch. Everything else (react, react-dom, radix, lucide, clsx, tailwind-merge) is deliberately NOT declared while this lives in the monorepo: declaring them at versions that did not match the root produced a second copy of react under this package, which breaks hooks at runtime and is invisible until something renders. Publishing standalone means declaring them all, aligned with the host.",
|
||||
"_dependencies_note": "react and react-dom are peers, marked optional so bun does NOT install them here. Bun installs peer dependencies by default, and a copy of react under this package means TWO React instances \u2014 hooks break at runtime and nothing says so until something renders. Optional peers give a consumer the correct metadata while the monorepo keeps one React. react-resizable-panels is pinned to ^2.1.7 deliberately: this code uses the 2.x API (PanelGroup, `order`, `ref` on Panel), which 4.x removed.",
|
||||
"dependencies": {
|
||||
"react-resizable-panels": "^2.1.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=18",
|
||||
"react-dom": ">=18"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"react": {
|
||||
"optional": true
|
||||
},
|
||||
"react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user