Next.js Discord

Discord Forum

An instruction in Chapter 8 of the tutorial is a bit ambiguous

Unanswered
Pyrenean Mountain Dog posted this in #help-forum
Open in Discord
Pyrenean Mountain DogOP
[Making the dashboard dynamic](https://nextjs.org/learn/dashboard-app/static-and-dynamic-rendering#making-the-dashboard-dynamic) culminates with the instruction "...and call it the top of your data fetching functions".

The ambiguity lies in the fact that it isn't certain whether you are to add the specified code to only the functions shown in the code sample (on the tutorial page) or to identify the functions that are "data fetching functions" in your local code base and use that to determine what functions to modify. If I only add the code to the functions shown in the code sample then there will remain two functions in my local code base that aren't accounted for in the code sample (namely fetchCustomers() and getUser()). If only midifying the functions indicated by the code sample is the wrong approach then there could be some function in my local code base that should have the specified code added to it but does not - and it may not break the application so you wouldn't be able to detect there is a discrepency. HOWEVER.. if instead I take the approach that I should identify functions in my local code base that are "data fetching functions"; then, at a minimum, I have to determine whether either or both of fetchCustomers() and getUser() are data fetching functions. In that case the first thing I would ask myself is how to accurately determine that. Is it because the function name contains the word "fetch" in it (so then getUser() is disqualified and does not get modified) or is there some other criteria to be used? This latter approach just results in further confusion and does not guarantee that all the functions that should be modified get modified and that no function that should not be modified is modified (ie: a correct result).

So which is it? I think its critically important to acheive a correct result (or I wouldn't be asking) - but what is the right approach to acheive it?

1 Reply

Pyrenean Mountain DogOP
I guess if I look at the body of fetchCustomers() it does look like it fetches data. It has sql keyword as well as sql statements. If I look at the body of getUser() I don't see anything that looks like it fetches data according to what fetching data should mean (ie: querying a database and pulling in the result). I'm gonna roll with modifying fetchCustomers() (in addition to what the code sample shows) but not modifying getUser(). I guess that's correct?