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

Next.js HMR sometimes not working #63

Closed
schickling opened this issue Dec 6, 2021 · 7 comments
Closed

Next.js HMR sometimes not working #63

schickling opened this issue Dec 6, 2021 · 7 comments
Labels
blocked-upstream This issue is currently blocked by another problem/limitation in an upstream package meta: never-stale more-info-needed

Comments

@schickling
Copy link
Collaborator

I've noticed that in some situations Next.js' HMR stops working after some time. I suspect this rather to be a problem in Next.js than in Contentlayer but I'm not certain yet since I can't yet reliably reproduce the problem.

If someone else faces the same problem, please share your situation below in the comments. 🙏

@stale
Copy link

stale bot commented Feb 4, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale label Feb 4, 2022
@schickling schickling added the blocked-upstream This issue is currently blocked by another problem/limitation in an upstream package label Feb 4, 2022
@stale stale bot removed the meta: stale label Feb 4, 2022
@stale stale bot removed the meta: stale label Feb 4, 2022
@schickling
Copy link
Collaborator Author

I was able to confirm that this is indeed a bug in Next.js (thanks @sokra for your help!). The problem is that Next.js seems to only listen to changes for ~30 seconds after the last change and then automatically "unsubscribes". This might change with the introduction of React Server Components.

@OmkarK45
Copy link

OmkarK45 commented Feb 5, 2022

Hey! is there any fix in this case!?
Would polling work ?

@schickling
Copy link
Collaborator Author

Unfortunately I'm not aware of any workaround / solution to this problem but I'm in touch with the Next.js team about it. I've also just filed a bug report for it: vercel/next.js#34054

@OmkarK45
Copy link

OmkarK45 commented Feb 7, 2022

Alright no worries. Thanks a lot for creating this lib <3

@schickling
Copy link
Collaborator Author

Seems like this can be configured like here: https://nextjs.org/docs/api-reference/next.config.js/configuring-onDemandEntries

Will look into how to make this the default behaviour for Contentlayer out of the box soon.

@schickling
Copy link
Collaborator Author

schickling commented Feb 28, 2022

This should be addressed with 0.1.2.

However, ideally the workaround implemented with 0.1.2 isn't necessary in the future when the underlaying Next.js problem has been solved (see vercel/next.js#34054 (comment))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked-upstream This issue is currently blocked by another problem/limitation in an upstream package meta: never-stale more-info-needed
Projects
None yet
Development

No branches or pull requests

2 participants