Did Josh Make A Mistake?

  Рет қаралды 141,559

Web Dev Simplified

Web Dev Simplified

Күн бұрын

Josh’s channel is full of great videos with generally great advice, but unfortunately this latest video of his didn’t quite hit the mark. The advice he recommends in this video is actively harmful for a large portion of the world and in this video I wanted to express my own opinion on how to solve the problem Josh proposed in his video.
📚 Materials/References:
Josh’ Original Video: • The Most Underrated Da...
🌎 Find Me Here:
My Blog: blog.webdevsimplified.com
My Courses: courses.webdevsimplified.com
Patreon: / webdevsimplified
Twitter: / devsimplified
Discord: / discord
GitHub: github.com/WebDevSimplified
CodePen: codepen.io/WebDevSimplified
⏱️ Timestamps:
00:00 - Introduction
00:30 - The Problem
01:19 - Josh’s Bad Solution
02:45 - My Solution
04:23 - Advanced Solution
#JoshTriedCoding #WDS #ReactJS

Пікірлер: 550
@joshtriedcoding
@joshtriedcoding 6 ай бұрын
Haha I knew it man! Jokes aside, great suggestion. Really like the idea of letting the user choose to cancel after the delay message. Cheers
@rajarshibarman4474
@rajarshibarman4474 6 ай бұрын
nice sub count bruh
@mubin-ansari
@mubin-ansari 6 ай бұрын
I love both yours and Web Dev Simplified's videos. Don't let this get to you Josh, take it positively! The AbortController thing was something new which I did not know came along with built in fetch API, so I'm glad you made that video.
@carlosraul6578
@carlosraul6578 6 ай бұрын
Both are amazing devs , I learn from both, keep doing your amazing job my bro 💪🏻
@emmanuelezeagwula7436
@emmanuelezeagwula7436 6 ай бұрын
@@ahmedjaber8595 facts
@WebDevSimplified
@WebDevSimplified 6 ай бұрын
Love your videos man. I don't mean this video to be negative at all. Honestly I hope it brings more people to your channel.
@illegalsmirf
@illegalsmirf 6 ай бұрын
The best solution is to use a 'please wait' loading wheel to entertain your users while they wait :-)
@Kraffcho
@Kraffcho 6 ай бұрын
and don't forget to add a hamster to that wheel 😅
@bravo1oh1
@bravo1oh1 6 ай бұрын
This actually
@codedusting
@codedusting 6 ай бұрын
This 🎉
6 ай бұрын
Funny I thought the best solution is to not let users wait.... junior devs.. sigh..
@Thr111ce
@Thr111ce 6 ай бұрын
@ sometimes stuff is out of your control, as a "not junior" developer you should know that.
@Sledgeh101
@Sledgeh101 6 ай бұрын
As a QA guy, forcing an error after a couple of seconds is awful. Thanks for the alternative solution!
@CottidaeSEA
@CottidaeSEA 6 ай бұрын
I agree. It is why I dislike forced timeouts.
@arjunnayak9088
@arjunnayak9088 6 ай бұрын
This solution is still not complete because if api responded before timeout, then the timeout function will still change the status to delayed after you get the response. All you need to do is to clearTimeout in the finally block.
@engine_man
@engine_man 6 ай бұрын
@@arjunnayak9088there is a clearTimeout in the finally block. Did you skip the whole video?
@SilviuBurcea1
@SilviuBurcea1 6 ай бұрын
@@arjunnayak9088 well, time for Josh to get his revenge: Did Kyle Make A Mistake? :D
@sagecoder8802
@sagecoder8802 4 ай бұрын
@@arjunnayak9088 He actually does clear it in the finally block.
@kev1ncast
@kev1ncast 6 ай бұрын
Damn. Never expected beef in the web dev community 💀
@Fl_ninja
@Fl_ninja 6 ай бұрын
It’s end-stage for every “content creator” industry it seems, lol. This ecosystem is my favorite though, and I’ve enjoyed some of the other collab videos with web dev content creators. Would definitely like more.
@verdaderoken
@verdaderoken 6 ай бұрын
lmao
@loopingdope
@loopingdope 6 ай бұрын
The beef between different stacks and like "purists" vs "jscripters", different backend languages, "no bloat" vs "get it done". I feel it is like constant "beef" of how to do stuff vs how not to.
@loopingdope
@loopingdope 6 ай бұрын
Ahh but you mustve meant between 2 people. That's true, and that's extremely rare
@manavkhandurie3591
@manavkhandurie3591 6 ай бұрын
Its not a beef , just a suggestion or Alternative way to a common problem
@najmulhc
@najmulhc 6 ай бұрын
This is interesting, actually, Josh's solution was not that specific for the problem he wanted to solve. but as we can see Kyle has solved the whole problem in a smarter way. Good job man!
@okage_
@okage_ 6 ай бұрын
experience shows
@saidurrahmansiam
@saidurrahmansiam 6 ай бұрын
Really liked your way of correcting. I watch Josh's video regularly and I like his videos too. But the way you corrected him without ranting leaves me with a round of applause for you. Keep making great video you two 👍
@TRIC4pitator
@TRIC4pitator 6 ай бұрын
Normal beef be like: "I disagree with your opinion" Programmer beef be like: "If you implement this your bloodline will suffer a 2 second delay for the rest of history"
@PenguinjitsuX
@PenguinjitsuX 6 ай бұрын
LOL
@jigsaw2253
@jigsaw2253 6 ай бұрын
Cringe
@henzyd
@henzyd 6 ай бұрын
🤣🤣
@anirudhcodes
@anirudhcodes 6 ай бұрын
😂
@eveypea
@eveypea 6 ай бұрын
It is so good to see a youtuber doing a response video with constructive criticism. This is the noblest of Ye Olde KZbinr traditions
@martapfahl940
@martapfahl940 6 ай бұрын
Yes I think Kyle did it very kindly =)
@shantanukulkarni007
@shantanukulkarni007 6 ай бұрын
Thanks for making this video. KZbinrs generally never review other youtubers code. This is so much needed because today anyone can make coding video and there is so many wrong tutorial on KZbin which might you fired.
@mostinho7
@mostinho7 5 ай бұрын
Done thanks! When fetching data, you can set a timeout (setTimeOut) to change state from loading to delayed (you can have a separate delayed state) which notifies user that request is taking longer than expected or render loading icon
@genshian
@genshian 6 ай бұрын
Love both you guys. I loved the energy and passion you had in pointing out Josh’s mistake. You did roast him a bit too much in my opinion but at the end of the day it’s up to you guys to sort that out and it’s also the KZbin game too. I learned something so no loss on my end 🤷‍♂️
@outis99
@outis99 6 ай бұрын
A user pointed this out on his video and Josh actually proposed a similar solution to what you're showing in the replies but your video was necessary for sure
@hugodsa89
@hugodsa89 6 ай бұрын
Plot twist the user in the comments was Kyle
@IvanRandomDude
@IvanRandomDude 6 ай бұрын
Canceling requests can be dangerous and lead to unexpected results. Just because you canceled it in UI does not mean it is really canceled. What if the request invoked a lambda? Or it fired API to a payment processor? Or published event to the message broker? Good luck canceling that. So the user might think they canceled something while in fact their command was processed by the back end. I would limit canceling option only to GET queries.
@DenisEneotescu
@DenisEneotescu 6 ай бұрын
Obviously we still need to use our brain and not just copy paste what we see on the internet. The example he gives is...an example😮
@tamal
@tamal 6 ай бұрын
In such cases (invoke lambda or event published to a broker) it'll be an async call for which you don't have to wait. Worse case you get 4xx/500.
@nordern1
@nordern1 6 ай бұрын
As someone who had to live for years with a throttled 3G connection, thank you for putting out this much better solution. The accidentally dropped connections are bad enough, not need to purposely break your website, too.
@xbsidesx
@xbsidesx 6 ай бұрын
Kudos to you and to the original video, without it we wouldn't have a very good example. Also, there are people in other countries and lag. Think of people outside. Always. Please. Thank you.
@vld-blv
@vld-blv 6 ай бұрын
Great video, thanks! One note I would like to make: you can just declare controller right into the component body, so no need to store it in a ref then
@Dhruv-kumar657
@Dhruv-kumar657 6 ай бұрын
wow i am blessed to have two great coders soving problems on youtube. thanku Josh and WDS
@georgepetroff2364
@georgepetroff2364 6 ай бұрын
Thanks Kyle, I do also sympathize Josh but when I watched his "fix" it felt really wrong, thanks for your solution, it is by far the best workaround. Great content as always, keep it up!🔥
@BenniK88
@BenniK88 6 ай бұрын
Im happy that knowledge is corrected by other KZbinrs so KZbin as a Plattform is getting better in terms of proofing the information. Therefore we all have more valid information. 💪
@davidascholer
@davidascholer 6 ай бұрын
In the mountains here in the PNW, loading 100kb files can often take a few seconds. Kyle is right in calling this out. Use timeouts are almost never the way to go. They are very much a "newb" problem solving technique. I didn't feel he was throwing shade at Josh. Programmers NEED to call out bad practices. It's essential for developers building their skillset. Taking advice and not getting offended is an essential skill in itself for engineers ;)
@luke5100
@luke5100 6 ай бұрын
Yeah exactly. This video felt like the KZbin equivalent of a very normal code review, something those of us in the field have received and given many, many times. Nobody ever gets things 100% right, so getting an outside opinion on your work is always valuable
@olamilekanonaolapo4939
@olamilekanonaolapo4939 4 ай бұрын
Hi Josh, I so much appreciate your help and your helpful tutorials. Please I would like you to make a video of Bootstrap 5 in detail. Appreciate you, man.
@bosmertheincredible
@bosmertheincredible 6 ай бұрын
Previously it was like 2 posts on forum :D. now there are whole video recorded to exchange experience between devs :D Well it became so popular and public) btw, it also reminds me that everything on internet you find, may not be the best solution or ideal, there is always room to improve. So don't forget when you take someones idea/solution think on your own and try to make it even better! Thank you as always great video
@kevinvanniekerk2436
@kevinvanniekerk2436 6 ай бұрын
Can we have more of devs adding to advice given like thia vid? Would have never known the advice from josh, niw subbed to both. Sadly youtube makes it so the negative clickbait title is needed, but the idea of the video itself is awesome thank you.
@TheIpicon
@TheIpicon 6 ай бұрын
beautiful video, as someone who's often has a slow data connection, when I saw Josh's video I was shocked by this recommendation. nonetheless Josh's content is so goddamn good, so no hate, we all make mistakes sometimes. we love you Josh
@MoinKhan_10
@MoinKhan_10 6 ай бұрын
Kyle vs josh - dawn of justice for data fetching in react
@luantoningalvan8512
@luantoningalvan8512 6 ай бұрын
as a boy born in the countryside of Brazil, I have dealt with slow connections for many years. I love your channel, you always care about the accessibility.
@ryostyles9904
@ryostyles9904 6 ай бұрын
If we use react redux toolkit, we can set status to loading when the promise is pending, and when the status is loading, we can show a loading spinner component (and if necessary we can also add a message with timeout if loading is taking long)
@sanlinnphyo6372
@sanlinnphyo6372 6 ай бұрын
You both guys are really amazing. I have learnt a lot from u guys and am still learning. Thanks for this video btw
@luke5100
@luke5100 6 ай бұрын
If you work at a company as a software developer, this kind of thing is perfectly normal. This is why code reviews exist. I’m not familiar with Josh, but I hope he nor his fans will take this personally. Literally none of us gets everything right all the time, and that’s why two heads are always better than one. I encourage everybody to have other engineers review your code because they will find a way to break it, find new ways of doing things or just give you food for thought that you wouldn’t have considered
@lord-of-the-shinobi-world
@lord-of-the-shinobi-world 6 ай бұрын
This is the reason why we need to "teach each other" way of learning, instead of "self teaching" way. Two people will learn from one another, and be able to compare the results to figure out what is wrong faster than learning alone.
@paarsaJam
@paarsaJam 6 ай бұрын
I appreciate and thank you both my greate Teachers. Wishes the Best for you all helpers...
@novanoskillz4151
@novanoskillz4151 6 ай бұрын
Josh has 24 hours to respond…. With RAGE 😵
@AlanDanielx
@AlanDanielx 6 ай бұрын
Hahahha
@DiogoLScarmagnani
@DiogoLScarmagnani 6 ай бұрын
I just love Josh's channel, I hope after this video his channel grow higher and higher. Btw, thank you for the better solution.
@Atz22
@Atz22 6 ай бұрын
I don't know Josh or if you have a relationship with him, but it's a bit deep to dump on him like this. You could have easily made a video explaining the problem and your solution, as it is probably better and can be applied in many situations. In the video you definitely can say "I've seen other people like Josh come up with x solution for this problem, and it's bad for y reason".....but making a video with the thumbnail, title, and intro kinda ripping him is a bit out of order....just saying 🙏🏻
@NerdistRay
@NerdistRay 6 ай бұрын
I hope Josh doesn't take this the wrong way
@randerins
@randerins 5 ай бұрын
He wants to solve this on a pokémon battle
@everettmckay2787
@everettmckay2787 6 ай бұрын
Nice work, Kyle. I will check out Josh's channel. The original premise is essentially "If your app is slow to respond, your users will hate you", apparently assuming that the delay is your server's fault. However, reading the comments, it looks like everyone who has experienced this problem lives in an area with poor connectivity...making it the network's fault. So, users won't hate your app, but rather already expect slow responses. That's another strike against the timeout solution.
@jacob_90s
@jacob_90s 6 ай бұрын
I'm genuinely shocked this is still a discussion that needs to be had. I thought it was well known already that one of the basic tenets of good interface design is responding back to the user that an action they've requested is processing correctly, or at bare minimum, that is has started. This is something that has long frustrated me with programs and websites that I use, as well from feedback from the users at the company I work for. One of the simplest solutions that I've found helps with this, is when the user pushes a Start/Process button, is to not only disable it as Kyle shows, but to change the text of the button to "Loading..." or "Processing..." or something to that effect. Just that one change caused a huge reduction in the number of complaints we got about the web page appearing to "freeze". So yes, please for the love of god give your users some indication that things have started and are working correctly. It will make your users much more comfortable with your site, and make things run more smoothly, as you'll have fewer people trying to run the same damn task over and over again because they keep thinking it froze.
@brayancuenca6925
@brayancuenca6925 6 ай бұрын
The art of fetching data, thank you for sharing these best practices. I’m looking forward implementing these into my projects soon
@user-re8lt2gy3g
@user-re8lt2gy3g 6 ай бұрын
More of this please!
@OladimejiIpaye
@OladimejiIpaye 6 ай бұрын
Excellent response to Josh here. This is how to give constructive criticism and I hope he doesn't take it wrongly. As a new coder, whose learning JavaScript I really enjoyed this video in general.
@ianfrye8988
@ianfrye8988 6 ай бұрын
I've been to sites with this solution and I really like it.. I'll get an update every 5 seconds with a different message or graphic on the screen. This is helpful and let's people know that you haven't ran into an unsolved problem..
@riacharda
@riacharda 3 ай бұрын
This is such a great approach. I definitely learnt something today.
@varchas-v8777
@varchas-v8777 6 ай бұрын
A loader with a second delay is the only solution we should look forward to. Providing a cancel button is like a solution looking for its problem.
@kueifengtung2693
@kueifengtung2693 6 ай бұрын
Your solution is totally better. I like the way you handled this as well reapectful of Josh but also spreading a better solution. Idk why ppl mad about Josh being on blast. Its not personal.
@riklaunim
@riklaunim 6 ай бұрын
Some backends may want a timeout due to a request taking an HTTP worker for way too long, potentially starving the server from workers for other requests. I use 10s timeouts for API microservices.
@lastspoil5547
@lastspoil5547 6 ай бұрын
Hey, can you add a transcript feature to your courses? It would help us with documentation.
@diddlenfiddle7311
@diddlenfiddle7311 6 ай бұрын
Good on you for this correction vid and for making it about geniune advice and nothing mean spirited. I do think if you're going to be advicing people on a subject you should really know what you're doing first.
@gilangeizan2282
@gilangeizan2282 6 ай бұрын
i thought it was just a clickbait or doing some collab, holy moly
@erinmaidensfx892
@erinmaidensfx892 6 ай бұрын
Same 😬
@darshilvaria441
@darshilvaria441 6 ай бұрын
Kyle this content is gold mine for beginners. Could you please explain how have you used - -delay 10 in package.json script section to hold api for 10ms
6 ай бұрын
Welcome back!!
@myahiaoui
@myahiaoui 6 ай бұрын
Both strategies - employing an abort mechanism or sustaining user engagement during wait times - hold merit depending on the scenario and chosen strategies. There are situations where data may become irrelevant post its time to live, protocol like UDP renders data delivery as less critical thus accepting some data loss. If a timeout occurs and the data is no longer needed or less relevant it's advisable to initiate an abort. However, when the data's importance exceeds a certain threshold the emphasis should shift towards enhancing the user experience. Aborting the process solely to enhance UX without alignment with business logic is ill-advised. It's crucial to harmonize user experience and business necessities when determining the strategy for data fetching.
@zunnoorainrafi5985
@zunnoorainrafi5985 6 ай бұрын
Hi Kyle! When you release your Next.js course?
@neociber24
@neociber24 6 ай бұрын
I agree with this solution, givin the user feedback is for sure better than cancel the request
@HungNguyen-vi4rr
@HungNguyen-vi4rr 5 ай бұрын
1:20 wow I'm speechless that someone called it as a "solution". 10 years ago we applied delaying message and even automatically retry. It does not easy to create a dev channel nowadays, that's why Kyle is rock.
@napapt
@napapt 6 ай бұрын
I don't watch this dude's every video like I do with the fireship channel, but this click bait title is telling: some tea is about to get spilled 🧐
@dgoenka1
@dgoenka1 6 ай бұрын
also, if axios is used, it has a built in abort controller (read timeout), so less boilerplate
@karansethia1037
@karansethia1037 6 ай бұрын
Or we can set a loading state and that state can conditionally add a loader component or plain text for user to see while users wait
@codeddesign
@codeddesign 4 ай бұрын
Great content indeed, next time we can encapsulate and make Josh a Private property inside this class, the code will still run smoothly and even better
@laurapeterson146
@laurapeterson146 6 ай бұрын
Would be interested to see how you see some of ByteGrad's videos as well. The guy *seems* to be a pro and gave out some good courses. But he did have some clickbait videos which I didn't watch full but seemed a bit too opinionated (and might be wrong?) Really looking forward to the reviews!
@yarapolana
@yarapolana 6 ай бұрын
I’m team Josh and I was expecting the usual “he sucks, I made it better” But this video was so mature and well articulated thanks for that, gained a follower❤
@nogovi2686
@nogovi2686 6 ай бұрын
Would you say this should be written in your code regularly then? and always a setTimeout? Wondering if there’s anything we can use in usequery or the fetch api to track the time it takes for data to be loaded.
@Juzzyjuzzy
@Juzzyjuzzy 6 ай бұрын
You can track Load time using performance.now(). Just place in your try block before the await and when the response.data is ready, call another performance.now() - then find the difference between the initial and current performance
@adejoh6650
@adejoh6650 6 ай бұрын
It's all Love.. Thanks for this correction!!!❤❤
@SeRoShadow
@SeRoShadow 6 ай бұрын
For the Josh's inital approach, here is my take: Devs (1) "dedicate time" (2) to build a solution that fullfills "given requirements" (3) based on their ... (a) "individual skill" ( does the dev have the skillset to do it ? ) (b) "exposure" ( has the dev ever ran into a particular issue ? would the dev account for a specifc situation ? what would happen if ... ? ) (c) "experience" ( will the dev be able to deal with the problems promptly, without second thought ? ) ... applied to any "given requirement"' Imo, as it stands, the code will likely be rejected at "Code Review" due to the fact there was "injected code" not explictly part of "given requirement", breaking rule 2 . Disclaimer: I am no TeamLeader. I was at some point a mentor for a fellow programmer. I provided him these guidliness and he told me he never ran into issues with Managment by following them.
@CyberTechBits
@CyberTechBits 6 ай бұрын
IMO there should be a DIALOG with a spinner that simply is displayed when the fetch is waiting. This is the best indicator that tells the user it's taking a while. So just call the DIALOG with a spinner. If the fetch is fast they won't even see it. Then ONLY if the fetch fails then change the DIALOG spinner to a message like the fetch failed and try again. WDYT?
@soywarmon
@soywarmon 6 ай бұрын
Living in Colombia I am used to have slow and unreliable connection in some places, even in the big cities of the country. So it is totally a good idea to show the users that their request is taking too long and let them decide. At the end of the day we're used to have this connection (depending on the place) and most of the time don't blame the website but the connection
@manavkhandurie3591
@manavkhandurie3591 6 ай бұрын
Yea However i would still wanna remove the cancel button for maybe like a ongoing-transaction , because that may lead to inconsistency
@kaicooper9421
@kaicooper9421 6 ай бұрын
You should do a vid about setting up that dev server
@theheroofthevirgins1487
@theheroofthevirgins1487 6 ай бұрын
I was thinking the same way when Josh says just put an error I was like why not give the user a message saying it is still loading just wait a bit longer. Because if it says an error people will just assume it is not working at all probably try again later or close it down. .
@nanonkay5669
@nanonkay5669 6 ай бұрын
My very first instinct was optimistic updates but this works too
@rjwhite4424
@rjwhite4424 6 ай бұрын
Kyle I am a little confused, is your fetch always going to wait that full 2 seconds before displaying data, or are the timeout and fetch happening at the same time? In short I guess I'm asking what happens if my request is finished in 1 second? Will it forget about that "taking longer than expected". I only want my users to be updated if my fetch is taking too long, not take X amount of seconds each time I request something
@SebbDev
@SebbDev 6 ай бұрын
I guess to keep the code simple he didn't include that part. All you have to do is just call clearTimeout(timeout) in the .then() callback.
@fksociety137
@fksociety137 6 ай бұрын
Love both these devs. Great share!
@dand4485
@dand4485 6 ай бұрын
Good video, but i'd think to be cleaner just set the variables that you display would have avoided the last bug/issue pressing 'canceld' but showing 'Error"...
@user-gs3lm7gt5e
@user-gs3lm7gt5e 6 ай бұрын
Love your idea. The only thing that I have problem with is that catch block catches the peniding state (while fetching data) as an error. Big L for javascript....
@diomepa2100
@diomepa2100 6 ай бұрын
Generally speaking making decisions on user behalf is worse UX. So I would agree this is a better solution, because it gives more choice to the user, who knows their circumstance. BUT Akshually! this is not the appropriate test, just use the throttling options in your dev tools. You'll be surprised that you can go down to about 5kbps before you manage to hit this limit (and it's still mostly http overhead). Most of the world will be just fine, the rest probably gave up waiting minutes for your site to download to begin with. I mean this is like 1/10 of dial up speed... You can have faster response time with slower internet. You can be bottlenecked by ping, or can be bottlenecked by throughput. So the large portion of the world with slow internet will be just fine because there is so little data to download. The users most affected would be the ones with intermittent connectivity problems, or really high ping. Anyway, better solution, but the effect of the mistake is largely, largely overestimated.
@mxz2024
@mxz2024 6 ай бұрын
thats why you use loadingspinenrs etc. for feedback if something is loading
@iamrajthomas
@iamrajthomas 6 ай бұрын
Someone never disappoints. Even josh would appreciate this with a smile. ❤ from India for you and Josh. Thanks.
@mindhood
@mindhood 6 ай бұрын
Oh, so that’s what it usually means when a web app says something like “response taking longer than normal” (I’ve seen many variations of this as an end user) - it’s still trying to fetch in the background, I don’t need to drag & refresh like a maniac 😅
@llanginger
@llanginger 6 ай бұрын
I really don’t understand the issue so many people in the comments have here. “Someone I like and whose content I think is good made a mistake, let me show you” is basically a textbook example of how to disagree professionally and openly. Disagreeing with your peers constructively is a central part of the job, especially as you become more experienced. I get that I’m equating two things here that aren’t strictly similar - 2 youtubers making videos at each other is not the same thing as a workplace, but imo the principal really applies.
@Sdirimohamedsalah
@Sdirimohamedsalah 6 ай бұрын
This is happening when someone jump into programming courses without reading foundation and history and why we have this tool and what solve . The biggest and the main goal of JavaScript is to animate web pages and make a better users experience on our websites.
@ts3798
@ts3798 6 ай бұрын
Good on you for changing the video title.
@Yotanido
@Yotanido 6 ай бұрын
I mean, ideally you would give the user some sense of progress. If it's taking very long, I would really like an estimate of how long the request is going to take and if it's making progress at all. Being blind sucks. Do you cancel? What if you cancel just before it's done? What if it will never complete? If you see the number of transferred bytes ticking up, at least you know it's still going.
@billyhart3299
@billyhart3299 6 ай бұрын
Could you do an HTMX video sometime? I know there's a bunch of HTMX tutorials already, but your teaching style is my favorite.
@stormyz_
@stormyz_ 6 ай бұрын
Another solution, not still good but can be good, is to do the request when you go to the website, stock the request response in a variable and when user click on the button you can show instantly the data or wait again if it stills not finished.
@safwanparkar7790
@safwanparkar7790 6 ай бұрын
This is not scalable. For instance, if there's 5 different possible requests that can be made from a certain page, then making those 5 requests to the server can be costly in many terms, especially when using serverless infra where the monetary cost can be a big factor.
@noname-nh8mx
@noname-nh8mx 6 ай бұрын
So, you'd rather download all the database when user visited your website? XD Just to don't let him wait some milliseconds
@stormyz_
@stormyz_ 6 ай бұрын
@@noname-nh8mx No for a complete database, but for little requests
@wchorski
@wchorski 6 ай бұрын
normal YT drama: SSSniperWolf vs JacksFilms my YT drama: Kyle vs Josh
@TianyiShen-nc5zb
@TianyiShen-nc5zb Ай бұрын
I haven't work with react for a long time, can some one tell me what's the error in 5:21? Why we need a useRef to call the abort?
@mastertainment116
@mastertainment116 6 ай бұрын
EDIT: The title has been edited and it looks a bit better. :) ORIGINAL: Yo - I find your title disrespectful man. Yeah you can be confident in yourself but to put Josh on blast like that is messed up. YOU are the one who has over 1 million subs and Josh is WAAY smaller than you. Putting negative titles out there on a lower channel is not cool.
@craigcaski
@craigcaski 6 ай бұрын
The thumbnail takes it over the top for me. It's weird because it doesn't match the actual tone of the video.
@Alex.Shalda
@Alex.Shalda 6 ай бұрын
Now follow Josh’s advice? Title maybe is, but there is no disrespect in the video itself, judging a video by its title is like judging a book by its cover
@ness3963
@ness3963 6 ай бұрын
Pretty sure this is his way of giving an indirect shoutout
@ahbegnueg
@ahbegnueg 6 ай бұрын
yeah! the title and the thumbnail, like wtf? dude don‘t be rude, and just tell us how to do it right, if someone told us something wrong, but do it professionally and not this way! You definitely lost a subscriber now 👋
@mastertainment116
@mastertainment116 6 ай бұрын
@@ahbegnueg I wouldn't say unsubscribe BUT I am not a believer of negative clickbait to pull in to watch. Yes we shouldn't judge a book by it's cover but it's a normal reaction and everyone does it to some degree. The video itself wasn't bad but the title and thumbnail are made in a negative way which could affect a lower KZbinr like Josh. I wouldn't unsub because I know webdev didn't do it to REALLY be a jerk. He did it for the algorithm. I just had to call it as I saw it
@gluetubeserver
@gluetubeserver 6 ай бұрын
Better way to solve is to not provide a cancellation via user input and just use a back off strategy. Slow speed will auto cancel request unless user feedback is provided within 1 second. If it happens again, 3 seconds, and so on..
@raymondtemplo5679
@raymondtemplo5679 6 ай бұрын
Could the abort controller have just been moved outside of the getUsers function instead of using the ref?
@harag9
@harag9 6 ай бұрын
That is a better solution to josh's when I saw his I was thinking exactly the same as you. I hope he does a follow up and doesn't take this as an attack, you're both doing a great job
@Vexius
@Vexius 6 ай бұрын
Question - so, what if the app loads the data sooner than expected? Such as 1second? Won’t our setTimeout run after 2 seconds and do unwanted things? How do we prevent our setTimeout function from running when the data loads sooner than expected? I’m a bit of a noob, so I apologize if this was covered in this video. Couldn’t pinpoint how our setTimeout is “destroyed” if the data loads quickly
@Hakunamatata-ojbk
@Hakunamatata-ojbk 6 ай бұрын
No, it won't because at the end of the fetch chain he added finally to clear the interval, so if the fetch settles within the settimeout interval, no matter resolved or rejected, it will eventually stop the settimeout.
@LarsRyeJeppesen
@LarsRyeJeppesen 6 ай бұрын
Observables with retry. If you are using Promised based Fetch we already have a problem
@albirtarsha5370
@albirtarsha5370 6 ай бұрын
Please do a design series.
@scottzeta3067
@scottzeta3067 6 ай бұрын
Even with fast connection, many other issue, like poor optimisation or pitiful free tier server, no CDN can related to slow connection. It is quiet common in new developer.
@3dxspx703
@3dxspx703 6 ай бұрын
is it just me? did he changed the title of the vid? O.O
@ahmedhafiz2419
@ahmedhafiz2419 6 ай бұрын
I hope people who watched that video watch this video. Where I live, data can go so slow it takes few seconds to load even the simplest websites. It'd take more than 10secs to load a big one
@rohitpal7836
@rohitpal7836 6 ай бұрын
HELPPP!!!!!!!...... What extension is user by kyle to display "GET /users 304......" in console , very interesting
@arjunnayak9088
@arjunnayak9088 6 ай бұрын
You forgot to clearTimeout in your finally. If api responded early with success or error setTimeout will change the status to delayed after your API responded.
@carlosmspk
@carlosmspk 6 ай бұрын
I think you should develop a minigame for the user to play while he waits. It's the least you can do
@Endrit719
@Endrit719 6 ай бұрын
yes, I agree, this was a big mistake and I also think Josh in general is great. Many newbies could have gone the wrong way, I hope he completely removes that video, because not everyone who sees it will see this.
@rogerangel9457
@rogerangel9457 6 ай бұрын
Nice collab guys 😉
@alexrusin
@alexrusin 6 ай бұрын
What if it's a POST request? If a user tries to create a pet in the database and request takes a long time, clicking cancel button won't cancel insertion of a pet in the database. In this case cancel button is misleading. Also in real life GET request won't fetch data from db.json. It will run a query on a real database. Clicking cancel button won't cancel query in the database. If we give users too much control they may tank the database by repeatedly clicking Cancel and Load Users button. In a way, Josh's solution is better. Network latency is usually very small compared to database latency. Automatically cancelling request and suggesting to check back in 30 mins or so may save application from crashing completely.
@safwanparkar7790
@safwanparkar7790 6 ай бұрын
> If we give users too much control they may tank the database by repeatedly clicking Cancel and Load Users button. That's why rate limiting is an important design choice. If a user is making too many identical requests, time them out. > in real life GET request won't fetch data from db.json. It will run a query on a real database. Clicking cancel button won't cancel query in the database. Correct! But this video was just a demonstration, trying to simulate a real-world scenario.
@jamesnelson174
@jamesnelson174 6 ай бұрын
How can this be done when using redux toolkit and redux toolkit query.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 442 М.
WTF Do These Even Mean
13:44
Web Dev Simplified
Рет қаралды 69 М.
Godzilla Attacks Brawl Stars!!!
00:39
Brawl Stars
Рет қаралды 9 МЛН
The World's Fastest Cleaners
00:35
MrBeast
Рет қаралды 125 МЛН
Why People Aren't Deploying to Vercel Anymore
5:55
Josh tried coding
Рет қаралды 139 М.
How Did I Not Know This TypeScript Trick Earlier??!
9:11
Josh tried coding
Рет қаралды 198 М.
10 Tailwind Classes I Wish I Knew Earlier
13:31
Web Dev Simplified
Рет қаралды 150 М.
React in under 3 minutes
2:45
Karthik Nooli
Рет қаралды 151
You might not need useEffect() ...
21:45
Academind
Рет қаралды 130 М.
Corel Linux - The (Word)Perfect Operating System
25:40
Michael MJD
Рет қаралды 91 М.
Most Senior React Devs Don’t Know How To Fix This
9:25
Web Dev Simplified
Рет қаралды 182 М.
You Suck At Accessibility (But You Don't Have To)
13:23
Web Dev Simplified
Рет қаралды 50 М.