Skip to content
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

Hot reload is complaining about named functions in nextjs #117

Closed
cipriancaba opened this issue Jun 16, 2021 · 4 comments
Closed

Hot reload is complaining about named functions in nextjs #117

cipriancaba opened this issue Jun 16, 2021 · 4 comments

Comments

@cipriancaba
Copy link

./node_modules/d3-format/src/index.js
Anonymous function declarations cause Fast Refresh to not preserve local component state.
Please add a name to your function, for example:

Before
export default function () { /* ... */ }

After
export default function Named() { /* ... */ }

A codemod is available to fix the most common cases: https://nextjs.link/codemod-ndc

This was referenced in #114 as well

@Fil
Copy link
Member

Fil commented Jun 16, 2021

same answer as in #114: that's an issue with next.js not with d3-format

@Fil Fil closed this as completed Jun 16, 2021
@cipriancaba
Copy link
Author

Hi @Fil , thanks for the quick feedback on this. Just to clarify that this issue is related to anonymous function declarations rather than any module discussion

I am willing to open a PR that will change the default anonymous functions to named functions. The functionality will be exactly the same, but will help other frameworks that rely on fast refresh, will help debugging and so on.

@fabienheureux
Copy link

@Fil don't you think @cipriancaba suggestion would help make d3 works properly for more users out there ?
Next.js is a widely used technology in React ecosystem and it does not look like this change would break features on d3's side.

@Fil
Copy link
Member

Fil commented Jul 26, 2021

From the wiki: "D3 is not a compatibility layer". Please help fix your favorite dev environments so they do the right thing. I'm locking this issue as a duplicate of #114, which has more details including a workaround.

@d3 d3 locked as resolved and limited conversation to collaborators Jul 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants