- AuthorPosts
- June 16, 2022 at 6:52 am #54423Joshua BeersGuest
Hi there,
I have been using your plugin for some time. I finally decided to put the browser cache on and now users cannot see an update to the css & js.We are getting errors for React “Uncaught Error: Minified React error #140”. In addition, new classes added to some elements for tickets to go on sale do not show up due to the caching.
As soon as we turn off w3 it works just fine. I have tried different checkboxes within browser cache, etc and even turning off browser cache, but I cannot turn on W3 caching again b/c the site will not work properly.
Any ideas?
Thank you,
JoshJune 16, 2022 at 6:57 am #54444Marko VasiljevicKeymasterHello Joshua,
Thank you for reaching out and I am happy to assist ou with this.
We do, have an option for that and it’s called “Prevent caching of objects after settings change” in Performance>Browser Cache.
You can set this option globally, or set it for the individual file types (HTML&XML, JS&CSS, Media&Other files).
What this option does is add a query string to a resource –?xNNNNN
How this works in your case:
1. Minify is enabled and the files are cached:
https://yourwebsite.com/wp-content/cache/minify/02dfe.js
2. Enable “Prevent caching of objects after settings change” in Performance>Browser Cache, under the CSS/JS section, save all settings, and purge the cache.
3. If you check the website after that, you will see that the existing minified file has a random query string at the end:
https://yourwebsite.com/wp-content/cache/minify/02dfe.js?xNNNNN
4. The browser will fetch a new file version as it does not have the file with the query string cached.
5. If you make any changes in JS or CSS that are minified (or not), once the changes are done, go to either Performance>Browser Cache, or Performance>Minify and click on the Update Media query string button, just above the General sub-box, and make sure to save all settings and purge the cache after that
This will ensure that a new query string is generated and therefore force the browser to fetch the new version of the file from the server.I hope this helps and let me know if you have any other questions.
Thanks!June 17, 2022 at 11:48 am #54478Joshua BeersGuestHi,
Thank you for this answer. So I think I understand your response, but I do not have minify turned on at all. The issue occurs within browser cache. I think the query string option you mentioned should work for any new js & css files, but what about html js & css inline?I believe the js & css inline classes & js differences are not being updated when clearing the cache. Does this make sense?
Is there a setting that would refresh the html as well b/c that contains css + js on the page.
Thank you in advance for all of this – really appreciate it.
JoshJune 17, 2022 at 12:09 pm #54481Marko VasiljevicKeymasterHello Joshua,
It seems that I misunderstood the issue.
To answer your question, yes the random query string is added to all static files (you can choose which one in Browser Cache settings) and I took minified file as an example since the error was showing minified error.
So to confirm, this was not an issue before you enabled BC, and once you enabled it the issue started to occur? And even when BC is disabled in the General settings, the issue is still there?
As for the inline CSS (I strongly advise revisiting this as an option :)) This is a part of the HTML. So if the HTML is changed, and the cache is purged, the new and updated HTML is served to the users.
After a closer inspection, this error message is coming from React which is a JavaScript library for building user interfaces. Next to an error, there should be a link: https://reactjs.org/docs/error-decoder.html/?invariant=140
And this is suggesting that Expected hook events fire for the child before its parent includes it in onSetChildren()So, this is the first time I am seeing this kind of problem, and related to W3 Total Cache. What I can advise is to disable all settings in W3 TOtal Cache, make sure that .htaccess does not contain any W3TC rules, and re-enable W3TC and the settings within the General settings one by one, saving the settings and purging the cache after each setting is enabled.
If the problem is in the Browser Cache, go to the Browser Cache settings, disable the settings one by one, also save all settings and purge the cache after each setting is disabled, and see which setting may be causing this.Thanks!
June 20, 2022 at 1:14 pm #54484Joshua BeersGuestOk, if I find out the issue is there anyway to enable it and not have customers run into this issue as they browse the site because they already have the cache headers?
Also, this is running on nginx.
Thank you again!
JoshJune 20, 2022 at 1:16 pm #54580Marko VasiljevicKeymasterHello Joshua,
Once the Cache is purged, the visitors should see the updated version of the HTML as the browser will fetch the new cached page.
Thanks!
- AuthorPosts
- The topic ‘Browser Cache’ is closed to new replies.