Design comparison
Solution retrospective
when you inmediately click on the button after the advice shows up on the screen, it flashes and shows the same advice, it takes like a 2 or 3 seconds delay to show a new one, if you click on the button during these time, it will not change. I couldn't find out how to help that, i want the request to be faster and smoother. i will be checking some other solutions to see if i can do it.
Community feedback
- @Dev-MV6Posted 7 months ago
Just in case you need it in the future...
You can control HTTP cache with the
Cache-Control
header:- Using the Fetch API:
fetch(url, { method: "GET", cache: "no-cache" });
You should give this article a read, it will give you a better understanding of how HTTP caching works: https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching
Marked as helpful1 - @DennyIsNaivePosted 12 months ago
This problem is not your fault. Rather data is being stored (cached for a period of 2 to 3 seconds). This problem is inherent from the API and is even specified in the documentation. To resolve this, you might have to use another API or you can set the cached state to no-cache explicitly so no data is cached at all.
Marked as helpful1@Kyureus1Posted 9 months ago@DennyIsNaive thanks god it wasn't me, is it possible for me to change the cached state you mention and how?
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord