Latest solutions
Latest comments
- @ElenaAnnibaliSubmitted over 2 years ago@emanueleguriniPosted over 2 years ago
Elena, pay attection on Firefox because some browsers caching the data from a specific server, and in this case Firefox detects that you are sending the request to same end-point, and he try to give you back the data in a faster way sending back the data that your already got before.
As you know, when you work with HTTP methods you can set many info inside your request (https://developer.mozilla.org/en-US/docs/Web/API/Request/cache), so in that case you need to tell to your browser that you don't want to cache the data: fetch(url, { cache: "reload" })
0 - @lidiakrajewskaSubmitted over 2 years ago@emanueleguriniPosted over 2 years ago
Some browsers caching the data from a specific server, and in this case Firefox detects that you are sending the request to same end-point, and he try to give you back the data in a faster way sending back the data that your already got before.
As you know, when you work with HTTP methods you can set many info inside your request (https://developer.mozilla.org/en-US/docs/Web/API/Request/cache), so in that case you need to tell to your browser that you don't want to cache the data: fetch(url, { cache: "reload" })
Marked as helpful1 - @mattyoung7Submitted almost 3 years ago@emanueleguriniPosted almost 3 years ago
Hi @mattyoung7, well done, but reload doesn't works on FireFox: seem that FF caching the fetch result.
I found this solution on StackOverflow (https://stackoverflow.com/questions/72567690/ui-is-not-updating-on-click-event-that-triggers-a-fetch-on-firefox-developer) but the problem is that property called count is always incremented by one, and, if you start a new session, advice is always the same in a row.
To avoid the same advice in a row, as you can see from my solution, I create a new Random number, and I use it only if my script detects firefox browser.
My solution: https://github.com/EmanueleGurini/js-advicegenerator/blob/master/js/main.js
ps. why am I using 224 as max number? Advices are 224.
0 - @eyedent1tySubmitted almost 3 years ago@emanueleguriniPosted almost 3 years ago
Hi Mirai, well done, but reload doesn't works on FireFox: seem that FF caching the fetch result.
I found this solution on StackOverflow (https://stackoverflow.com/questions/72567690/ui-is-not-updating-on-click-event-that-triggers-a-fetch-on-firefox-developer) but the problem is that property called count is always incremented by one, and, if you start a new session, advice is always the same in a row.
To avoid the same advice in a row, as you can see from my solution, I create a new Random number, and I use it only if my script detects firefox browser.
My solution: https://github.com/EmanueleGurini/js-advicegenerator/blob/master/js/main.js
ps. why am I using 224 as max number? Advices are 224. Ema
Marked as helpful0 - @Gareth-MooreSubmitted almost 3 years ago@emanueleguriniPosted almost 3 years ago
Hi Gareth, seems that Firefox is caching the fetch result. I found this solution on StackOverflow (https://stackoverflow.com/questions/72567690/ui-is-not-updating-on-click-event-that-triggers-a-fetch-on-firefox-developer) but the problem is that property called count is always incremented by one, and, if you start a new session, advice is always the same in a row.
To avoid the same advice in a row, as you can see from my solution, I create a new Random number, and I use it only if my script detects firefox browser.
My solution: https://github.com/EmanueleGurini/js-advicegenerator/blob/master/js/main.js
ps. why am I using 224 as max number? Advices are 224.
Marked as helpful0 - @f3anSubmitted almost 3 years ago@emanueleguriniPosted almost 3 years ago
Hi Ihor, I was checking your solution and I think that is well done. Btw, when you search a user that does not exist and try to change color theme, there are some problem with the middle box: does not update color.
Emanuele
Marked as helpful1