I'm working on a website made in react and all the changes I make in this site I always need to clean the AppData, does it always happen in React or do you have a way to bar it?
The browser may store cached files, cookies, as well as objects persisted with the Web Storage API within your AppData directory. You can clear this data by clearing your browsing data from within the browser.
Related
I want to build an app that would load all the data on first startup so app can be used offline. I also want to refresh the data periodically.
Does anyone have any experience designing that kind of application? I thought of using Firebase/AWS appsync but they don't load the data on startup. They cache the data once you load the page.
The data i have is from wordpress custom posts as well as some documents, images etc. How can I create a functionality to load the data on startup and keep it sync with the server.
Any link to example opensource/github/npm project would be helpful.
Thanks.
You could use that pattern,
start by loading your content using a hook, display a loading screen. Once content has loaded, just display the app.
Therefore you can rely on some cache, this is working pretty well with apollo client JS or things like https://github.com/tannerlinsley/react-query
This article can help your for your app start:
https://medium.com/javascript-in-plain-english/how-to-handle-and-design-the-startup-of-a-react-application-da779f3727e5
DNS Is being handled via Route53. Previously, had a React SPA deployed on AWS S3 (with Cloudfront dist + SSL). Moved off of that to a SSR NextJS app on ElasticBeanstalk, but even after changing the A records and invalidating CF, some users are still reporting their browser is using the old S3 SPA. Only fix is for them to manually clear their cache for the site.
Asking each random user that's cached my site to manually refresh their cache for the page doesn't seem like a good solution ;)
Here's what I've done thus far:
Updated Route53 (A record) to point to the EB server (this is working as intended),
Tried disabling the associated CF distribution,
When that didn't work, I removed the files in S3 and invalidated the CF dist,
EDIT: After deleting the CF dist completely, users are able to go to the new site - but only after hard-refreshing a half-dozen times. I still feel like there should be a more elegant solution to this requiring little/no user know-how.
All of my CSS & JS files had version numbers appended to help with cache-busting. Users report that they see the HTML structure of the page, but the versioned JS & CSS 404 for them (as they should, since the files no longer exist).
I would have thought this would be enough to have the browser swap update its cache - but apparently not. Only solution so far has been for affected users to manually clear their cache.
More than happy to offer more details if needed, any thoughts/input is super appreciated!
Use case
I'm building an app that has support for translations. The way I imagined it is that the app will come with English by default and will be sent around to different places. When it arrives in Germany (for example) a user will add German as a translation and then send it to France. The French user will be able to see both the original language (engligh) and German.
Background
The app is a React web app wrapped in Electron.
For the use case I implemented the localStorage API to store content changes and switch between different translations.
Problems
After building the app as a portable exe and testing it I started noticing that the content doesn't carry over to a new PC.
It seems like the data is stored on the system or something else is happening (like localStorage gets wiped when moving the portable exe to another machine).
In my view, because I'm using localStorage and Electron bundles the Chromium browser with the web app I was expecting localStorage to be saved within the portable app.
Would love to hear your opinion on this
Thanks a million.
The localStorage is not saved to your app's binary files but rather to a file on your account's part of your PC's file system.
On Linux, for example, Electron creates a directory for your app in ~/.config and stores your localStorage data there. I imagine that you might find a directory for your application in %APPDATA% (C:\Users\YourUsername\AppData\Roaming\ or similar) on Windows.
What you could try is to write your data to a file in your app's resources bundle which would be preserved while re-distributing, but that's another question and answer.
I have recently put an admin-on-rest app into production and it works great. However, when I update the app, the updated files within my project src directory are cached. For example I made a change to the restClient.js file, but this only gets loaded after users do a CTRL+F5 in the app.
What is the recommended way to handle this? Can I somehow add a cachebust to the files? Or should I simply set expires in the index.html file head section?
Ps. this questions is maybe more related to React apps in general then admin-on-rest..
I have fully bought into the benefits of using angular and have a a hybrid app (using PhoneGap) I'm going to convert over (from Jquery Mobile) but I'm having a problem figuring out how to get my new code to the app.
The app is currently hosted on our website (NOT local to the device) so normal caching works as expected. I update a web page or js and the app sees the new content (because the underlying webview/browser knows its new content).
But with angular's SPA approach the main module gets loaded up front and changes views based on loading new partials. Also not a problem.
BUT, what happens when I change my app module (the code loaded by ng-app="demo")? Such as adding new routes, controllers, or views.
Since that's already loaded in the browser at bootstrap how do I tell the app there are changes and it needs to reload the overall app?
There are 3 use cases to consider:
1) On a PC/browser you can just refresh the page. I can't depend on users knowing to do that but its not as bad because users are likely to open and close their browser thus reloading the new app/js.
2) When I issue a new PhoneGap app (to the app stores) it forces a browser close/reopen during the installation, so the user will get the new code.
3) THIS IS THE REAL STICKLER. During normal use of the PhoneGap app users may open the app and NEVER close it again (merely suspending and reopening). These are not tech-savvy users and might not even know how to restart an app never mind realize they should try.
So what's the angular way to force the app the refresh when the base app module has changed?
Or am I on my own to create some type of version checking system to force a reload() when I need it.
Seems like a common situation to me but everything I find on caching with angular says something to this effect:
"Since you probably want to maintain browser caching for your views, partials or other routes"
No I don't - I WANT to bust cache for my app/views/controller because i know it has changed.
angular phonegap cache buster
You could dynamically load/unload your controllers on each use. This article should get you started.