-
Notifications
You must be signed in to change notification settings - Fork 199
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 integration #84
Comments
I got to add it to the next.js examples indeed. you can add it as an entry in
where
|
If anybody wants to open a please notify me in this ticket. |
I've created a PR vercel/next.js#10662 |
beautiful! |
Quick update, message from maintainers:
You can see my answer here . Hope it is enough and feel free to jump into the conversation if you feel like it @vzaidman 😃 |
here is a working example of integration with next.js. |
With one of the recent Next updates, neither one of these methods work. @vzaidman And @motiko, I'm sorry to say your solution simply doesn't result in any output. Do either of you have any other ideas? |
are these solutions working on the last versions of wdyr and next? I can't get it working...no errore but nothing in console |
@francescovenica I still haven't figured it out, and I gave it a good go. |
I'll give it a try. I just stumbled upon WDYU and I think that'd be a great addition to https://github.com/UnlyEd/next-right-now Maybe I'll add into UnlyEd/next-right-now#42 if I get it to work. |
I've tried to add the following in if (typeof window !== 'undefined' && process.env.NODE_ENV === 'development') {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const whyDidYouRender = require('@welldone-software/why-did-you-render');
// eslint-disable-next-line no-console
console.debug('Applying whyDidYouRender');
whyDidYouRender(React);
} |
try
|
Alright, I also get this and understand a bit more how the logging is meant to work. Basically, it seems to be working fine to me, it's just that the So, looks like #84 (comment) does the job for Next.js. :) |
sadly it seems like issue #114 that i didn't solve yet. look inside for a workaround (in short it is assigning |
Thanks for the link, I understand the underlying issue, it's unrelated to Next.js. @francescovenica @mikestopcontinues #84 (comment) should do the trick for your Next.js app. I have it working using Next 9.4.0. My commit: |
Just checking in here, does this work if I do it in a Next.js app? if (process.env.NODE_ENV === 'development') {
if (typeof window !== 'undefined') {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const whyDidYouRender = require('@welldone-software/why-did-you-render');
whyDidYouRender(React, {
trackAllPureComponents: true
});
}
} |
Tried different approaches but wasnt able to make it work with next 12. No console output. |
@ivadenis did you try wiping the rm -rf .next; next dev For me, in our next project, I've noticed that WDYR doesn't enable unless you wipe the build folder |
hey all, having issues here too. At the top of of wdyr.tsx I put the following logger, and
|
any updates on this? |
There was no way to make it work for me: I added webpack config as suggested by @vzaidman , I ensured that it was loading wdyr.ts file by adding a log, I tried serveral babel tricks, but nothing worked untill I added the following
to From that moment onward, it started finally working! |
Can anybody confirm the example from the README works on Next 12? Anybody tried it with Next 13 yet? |
I tried all solutions from this thread, none of them works with Next,js 13. Importing Adding it to the next.config webpack did nothing. I tested that it's added by printing webpack entries to the console, the absolute file path was there. Logging from the file never happened. Importing it in a top level client component did also nothing. And logging from the script was printed to both, the browser console and the server terminal, it looks like it runs on the server being imported in a client component? (Sounds like I don't understand something, I'm still learning the concepts of Next.js 13 and client/server components). Anyway, it didn't work this way. I then tried to init
The problem with hooks order's disappeared sometimes for an unknown reason. A few times I was able to see the reasons for re-render after navigating successfully. But 99/100 times I just get the error about hooks order. With the same code and same actions (I just open a page and try to navigate using next.js links). It works fine until you try to navigate. I tested adding the following code to the top level client component and a child component. I got the reason as expected for both of them. I passed no options on the init.
|
Unfortunately i didn't have time to test it with the new You can see the new issue here I also pointed to an example from the official documentation that hopefully will be helpful in your situation. |
I can't get this working in NextJS 13 either, even in Also tried everything in this thread, including the Simply put, the import does literally nothing, no changes to output.
|
Can't make it work neither. Did anyone find something? |
I've tried a number of locations, and I can't seem to make this work with Next. What's the recommended solution? Thanks!
The text was updated successfully, but these errors were encountered: