diff --git a/crates/oxc_transformer/src/react/refresh.rs b/crates/oxc_transformer/src/react/refresh.rs index d870e8ec5..8f2961a1b 100644 --- a/crates/oxc_transformer/src/react/refresh.rs +++ b/crates/oxc_transformer/src/react/refresh.rs @@ -384,10 +384,11 @@ impl<'a, 'ctx> Traverse<'a> for ReactRefresh<'a, 'ctx> { } if !is_builtin_hook(&hook_name) { + // Check if a corresponding binding exists where we emit the signature. let (binding_name, is_member_expression) = match &call_expr.callee { Expression::Identifier(ident) => (Some(ident.name.clone()), false), Expression::StaticMemberExpression(member) => { - if let Expression::Identifier(object) = member.get_first_object() { + if let Expression::Identifier(object) = &member.object { (Some(object.name.clone()), true) } else { (None, false) diff --git a/tasks/transform_conformance/tests/babel-plugin-transform-react-jsx/test/fixtures/refresh/nested-member-expression-with-hooks/output.js b/tasks/transform_conformance/tests/babel-plugin-transform-react-jsx/test/fixtures/refresh/nested-member-expression-with-hooks/output.js index 43f61f030..339b6337f 100644 --- a/tasks/transform_conformance/tests/babel-plugin-transform-react-jsx/test/fixtures/refresh/nested-member-expression-with-hooks/output.js +++ b/tasks/transform_conformance/tests/babel-plugin-transform-react-jsx/test/fixtures/refresh/nested-member-expression-with-hooks/output.js @@ -3,7 +3,7 @@ export function Bar() { _s(); A.B.C.useHook(); } -_s(Bar, "useHook{}", true); +_s(Bar, "useHook{}"); _c = Bar; var _c; $RefreshReg$(_c, "Bar");