Skip to content

React 19 codeInfo is undefined, so the redirect doesn’t work. | codeInfoundefined,导致无法跳转 #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Fancyflame opened this issue Apr 10, 2025 · 2 comments

Comments

@Fancyflame
Copy link

Fancyflame commented Apr 10, 2025

用的react v19和rsbuild,windows 11,vscode,点击元素跳转不了。Inpector的onClickElement返回的codeInfo是undefined。感觉应该没有遗漏什么。onClickElement传回下图这个object
Image

const root = createRoot(document.body);

root.render(
    <React.StrictMode>
        <Inspector
            onInspectElement={({ codeInfo }) => {
                console.log("inspect");
                gotoVSCode(codeInfo);
            }}
            onClickElement={(codeInfo) => {
                console.log("click", codeInfo);
            }}
        />
        {/* App */}
    </React.StrictMode>,
);

rsbuild.config.mjs:

import { defineConfig } from "@rsbuild/core";
import { pluginLess } from "@rsbuild/plugin-less";
import { pluginReact } from "@rsbuild/plugin-react";
import { launchEditorMiddleware } from "@react-dev-inspector/middleware";

export default defineConfig({
    plugins: [pluginReact(), pluginLess()],
    jsx: {
        jsxImportSource: "react",
    },
    tools: {
        webpack: (config) => {
            config.plugins.push(
                new webpack.DefinePlugin({
                    "require('fs')": "undefined",
                }),
            );
        },
    },
    dev: {
        setupMiddlewares: [
            (middlewares, _server) => {
                middlewares.unshift(launchEditorMiddleware);
            },
        ],
    },
});
@zthxxx zthxxx changed the title codeInfo是undefined,导致无法跳转 codeInfo is undefined, so the redirect doesn’t work. | codeInfoundefined,导致无法跳转 Apr 11, 2025
@zthxxx
Copy link
Owner

zthxxx commented Apr 11, 2025

• React 19 no longer supports this feature — see issue facebook/react#32574.

• The change comes from this pull request.


@zthxxx zthxxx changed the title codeInfo is undefined, so the redirect doesn’t work. | codeInfoundefined,导致无法跳转 React 19 codeInfo is undefined, so the redirect doesn’t work. | codeInfoundefined,导致无法跳转 Apr 11, 2025
@Fancyflame
Copy link
Author

Alright, then I closed this issue as won't fix.

@Fancyflame Fancyflame closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2025
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

No branches or pull requests

2 participants