Skip to content

Conversation

@sophiebits
Copy link
Collaborator

Closure is adding additional arguments to the setState from useState to avoid accessing arguments, specifically to dispatchSetState:

function dispatchSetState<S, A>(
fiber: Fiber,
queue: UpdateQueue<S, A>,
action: A,
): void {
if (__DEV__) {
if (typeof arguments[3] === 'function') {

This changes the arity from 1 to 2 and is observable at runtime via setState.length. It only applies to dev.

@vercel
Copy link

vercel bot commented Nov 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 19, 2024 6:22pm

@poteto
Copy link
Member

poteto commented Nov 19, 2024

I'm not sure if the build failures are related but I think you can also update our java version now. We were stuck on an older version of Java because of the old closure compiler

@sophiebits
Copy link
Collaborator Author

Hm, looks like the dynamic imports in ReactFlightClientConfigBundler* are making it sad.

BUILDING  react-server-dom-esm-client.node.development.js (node_dev)
 OH NOES!  react-server-dom-esm-client.node.development.js (node_dev)

-- PLUGIN_ERROR (scripts/rollup/plugins/closure-plugin) --
Error: java -jar /home/runner/work/react/react/node_modules/google-closure-compiler-java/compiler.jar --compilation_level=SIMPLE --language_in=ECMASCRIPT_2020 --language_out=ECMASCRIPT5_STRICT --emit_use_strict=true --env=CUSTOM --warning_level=QUIET --source_map_include_content=true --use_types_for_optimization=false --process_common_js_modules=false --rewrite_polyfills=false --inject_libraries=false --allow_dynamic_import=true --assume_function_wrapper=true --renaming=false --js=/tmp/tmp-1894qaypoUKdNb6e

java.lang.IllegalStateException: AST should not contain Dynamic module import. Reference node:
DYNAMIC_IMPORT 129:24  [length: 26] [source_file: /tmp/tmp-1894qaypoUKdNb6e]
    GETPROP specifier 129:40  [length: 9] [source_file: /tmp/tmp-1894qaypoUKdNb6e]
        NAME metadata 129:[31](https://github.com/facebook/react/actions/runs/11919259100/job/33219506469?pr=31587#step:8:32)  [length: 8] [source_file: /tmp/tmp-1894qaypoUKdNb6e]

 Parent node:
NAME modulePromise 129:8  [length: 42] [source_file: /tmp/tmp-1894qaypoUKdNb6e] [constant_var_flags: 2]
    DYNAMIC_IMPORT 129:24  [length: 26] [source_file: /tmp/tmp-1894qaypoUKdNb6e]
        GETPROP specifier 129:40  [length: 9] [source_file: /tmp/tmp-1894qaypoUKdNb6e]
            NAME metadata 129:31  [length: 8] [source_file: /tmp/tmp-1894qaypoUKdNb6e]

Known issue?

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

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants