Closed Boshen closed 2 months ago
What is the 3rd argument true
/ false
?
What is the 3rd argument
true
/false
?
This argument means whether to force reset, But I don't how it does in the runtime of React Fast Refresh
The implementation of Babel handling here
I re-read this logic and I haven't seen the problem. Needs to debug how was going in Babel plugin
I think Babel logic output true
because it for trpc.viewer.me.useSuspenseQuery()
is analyzed as me.useSuspenseQuery()
and me
is not in scope.
I think the ideal output in the logic of fast refresh would be to have fals
and trpc.viewer.me.useSuspenseQuery
in the hook array, but I think following swc behaviour is better for compatibility
I think Babel logic output
true
because it fortrpc.viewer.me.useSuspenseQuery()
is analyzed asme.useSuspenseQuery()
andme
is not in scope. I think the ideal output in the logic of fast refresh would be to havefals
andtrpc.viewer.me.useSuspenseQuery
in the hook array, but I think following swc behaviour is better for compatibility
Thanks for your investigation. Now the output same as SWC, and then all of us implementation has some problems 😢
Using https://github.com/oxc-project/bench-transformer/blob/main/fixtures/UserSettings.tsx
With https://github.com/oxc-project/bench-transformer/blob/1d97626d9a40046e4be7a3538ec1a9378cdd64c5/src/transform.bench.js#L8-L9
Uncomment https://github.com/oxc-project/bench-transformer/blob/1d97626d9a40046e4be7a3538ec1a9378cdd64c5/src/transform.bench.js#L63
then run
pnpm run bench transform
Oxc produces
Babel produces
swc produces