Open jtoar opened 2 years ago
Workaround posted in the discord:
One thing that works for debugging for now is something like let lclcontext=context in your service. Then you should have access the the variable . But it would be nice to solve it properly !
Link: https://discord.com/channels/679514959968993311/970282715343642694/970417178153213953
This looks interesting. I will look into this.
I regret looking into this.
@IThinkThatsKirby What path did you take, what did you learn or what roadblock did you hit? Debugging is, for me, sort of a black box. So, I would be interested to hear any thoughts you have had. Discord is just as good a place to talk, if you are willing to talk, and if you don't want to muddy up the topic here.
@pantheredeye I have researched everything from how to declare typescript global variables to graphql resolution variables. VS code advertises their debugging as "it just works" and I'm beginning to think that's a lie. I gave myself burnout from all the docs I've read. Now I'm just trying to break things and see If I kan use that to help me figure out what's going on. So far I've managed to make context show up as a local variable.
So far I believe this is not really an issue.
I took a walk and bounced some ideas off my 2 year old. I think context is not going to show up as a global variable in VS Code's debugger. The way its created is more of a pointer to where its located and is defined from a return in a function that does not get run until context is referenced. So due to hoisting its referenced as a local variable when ever it is called. I will do a test to verify this hypothesis and report back my findings tomorrow after lunch.
OK so ill be spending the next few days learning how to make frameworks in typescript. then do the experiment.
I kant find any docs on HOW vscode debugger works, we need a debugger for the vscode debugger so we kan debug while we debug. I am 100% in the camp of its not actually global in the way JavaScript is run in the node or browser environment.
Its never hoisted high enough because its never defined. So it really doesn't exist unless called, and this context
variable seems unique to graphql resolvers for what I'm assuming are security reasons? I think its scope is also limited because it appears to be a response from a function that we then assign the value to a variable ONLY when the variable is requested. It would be great if someone with more experience in this department to take a look. I'd hate to be spittin' factn'ts.
The global context object that's available to services doesn't seem to show up in the VS Code debugger.