Skip to content

fix(react-vtable): lazy load custom layout reconciler - #5259

Open
fangsmile wants to merge 1 commit into
developfrom
fix/issue-5203-react-vite-render
Open

fix(react-vtable): lazy load custom layout reconciler#5259
fangsmile wants to merge 1 commit into
developfrom
fix/issue-5203-react-vite-render

Conversation

@fangsmile

Copy link
Copy Markdown
Contributor

What

Fix React 19 + Vite rendering failure when using simple @visactor/react-vtable ListTable.

Closes #5203

Root Cause

@visactor/react-vtable exports CustomLayout from the package entry. CustomLayout statically imported ./reconciler, which initialized react-reconciler at module load time.

In a React 19 + Vite app, even a simple ListTable import could therefore load the React 18 matched react-reconciler@0.29.0 during dependency prebundle and fail with:

Cannot read properties of undefined (reading 'ReactCurrentOwner')\n```\n\n## Changes\n\n- Lazy-load `CustomLayout` reconciler only when `CustomLayout` is actually rendered.\n- Keep normal `ListTable` usage independent from the custom-layout reconciler path.\n- Add a minimal React 19 + Vite regression demo for issue #5203.\n\n## Verification\n\n- Reproduced before the fix with `vite.config.issue5203.ts` + `#issue5203ViteReact19`:\n  - blank page\n  - no table/canvas\n  - `ReactCurrentOwner` console exception from `custom/reconciler.ts`\n- Verified after the fix with the same demo:\n  - `ready=true`\n  - `hasTable=true`\n  - `canvasCount=1`\n  - no console exception\n- Verified existing React 19 `customLayout` demo still works:\n  - `demoError=null`\n  - `hasTable=true`\n  - `canvasCount=1`\n- `git diff --check` passed.\n\nNote: `npm run compile` in `packages/react-vtable` is currently blocked in this worktree because `@visactor/vtable` package type outputs are not generated/resolved (`Cannot find module @visactor/vtable...`). This is an existing package build-order/environment issue, not introduced by this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] @visactor/react-vtable 用 vite 开发工具时下无法渲染

1 participant