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
[NEXT-369] Fast refresh doesn't work when importing function with capitalized name #35567
Comments
same issue here ! 12.1.2 |
12.1.2 gives me this problem straight off the bat from a clean create next-app |
Can confirm, in a blank create next-app project with 12.1.2, if you replace pages/index.tsx so function is exported as home rather than Home then fast-refresh works. |
12.1.3-canary.4 doesn't seem to exhibit this behaviour. |
@anthonyespirat @tholder were you using React 18? If so 12.1.3 has solved the issue with Fast Refresh on React 18. Related PR: #35718 |
fix with this downgrade
|
The reproduction I have provided uses 17.0.2 version and it still suffers from this bug. |
Just reproduced on |
Verify canary release
Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.4.0: Mon Feb 21 20:34:37 PST 2022; root:xnu-8020.101.4~2/RELEASE_X86_64
Binaries:
Node: 16.14.0
npm: 8.3.1
Yarn: 1.22.18
pnpm: N/A
Relevant packages:
next: 12.1.1-canary.17
react: 17.0.2
react-dom: 17.0.2
What browser are you using? (if relevant)
Chrome 99.0.4844.83 (Official) (x86_64)
How are you deploying your application? (if relevant)
Not relevant
Describe the Bug
I think that the reproduction repository I have prepared fully describes the bug so please have a look ⬇️ .
If we change the description prop in
lowercasedEnhancePropsFunction
function HMR will properly refresh the component with the updated data.But If we change the title prop in
CapitalizedEnhancePropsFunction
function then nothing will change in our component.Issue occurs only if we have a function with capitalized name, imported from another file and that's the only one export existing in this file. If we export anything else from this file (i.e. export const hack = undefined) HMR will work properly.
Expected Behavior
HMR should refresh the component with the updated data every time, no matter the name of the function we are importing.
To Reproduce
I have created a reproduction repository:
lowercasedEnhancePropsFunction
function - works.CapitalizedEnhancePropsFunction
function - doesn't work.NEXT-369
The text was updated successfully, but these errors were encountered: