Reset Redux state in browser during debugging - redux

So I am debugging my redux app on the browser, I had a bug which modified my state and I am also using redux- persist, the state is persisted on my browser.
I wanna reset the state to be an empty slate again, how can I do it ?

It was solved by using localStorage.clear() in browser's console.

Related

Redux RTK Query - useGet..Query does not update cache or does not request data from server

Here's the definition for the query, when I navigate to a page or the app restarts, all useGet...Query just returns the cache data (the data with the specific parameter indicated in the red box). Why does it not update when the page rerenders and only returns cache data? I will set many invalidate tags to ensure it can be forced to refetch but it does not work.
As I'm working with the expo, I don't know why but after I uninstalled the expo and re-install it then it works fine.

What causes iOS Safari to constantly reload a foreground page?

I keep getting reports from users on Safari that my webpage is automatically reloading itself about once per minute, while they're using the page.
My page doesn't do any history state modification, it doesn't use location.reload(), and it doesn't use a crazy amount of memory.
I know Safari might unload background tabs when it runs low on memory. What else can I do to troubleshoot why a browser reloads my page?
Is there anything in the beforeunload event that could help me identify the "source" of these reloads? Or is there some sort of response from an asynchronous fetch() call that would trigger a browser to reload a web page?

PayPal Checkout popup randomly closes

We are having an issue in a Blazor WebAssembly app, which is using PayPal buttons for users to Add Funds to the system's wallet.
The issue is random, sometimes the popup closes immediately after opening, and does not allow users to even login into paypal to continue with the checkout process.
This is the js file: https://github.com/efonsecab/FairPlayTube/blob/main/src/FairPlayTubeSln/FairPlayTube.Client/wwwroot/js/paypal/paypal.js
This is the Blazor component which calls the js to render the buttons
https://github.com/efonsecab/FairPlayTube/tree/main/src/FairPlayTubeSln/FairPlayTube.Client/CustomComponents/Paypal
It happens constantly in dev, but not that much in prod.
This is the error shown in the console:
No ack for postMessage wn() in https://www.sandbox.paypal.com in 10000ms
The thing is that sometimes everything works successfully on the first try, but other show this.
Any ideas how to solve it?
If it closes immediately after opening, the createOrder function's invocation of actions.order.create is failing, likely due to an invalid request. Log everything, look at the console errors/output, and find out what you are doing wrong.
The object you are passing to actions.order.create can first be saved to a variable, logged with console.log(JSON.stringify(somevar,null,2)), and then return actions.order.create(somevar)
After several hours searching and trying numerous suggestions, I finally found the answer with this post: https://stackoverflow.com/a/66473740
For me, this solution works 100% of the time so far. I disabled Javascript debugging.

IBM Worklight - How to use Worklight in a background process

I have an application that should run continuously even after the user presses the back button.
It has to send some data using POST method to my database in a remote server for every half an hour. This should happen even after the user has pressed the back button and the app should only stop when the mobile is switched off.
While I have set up the HTTP Adapter to send POST data and also an HTML file to call the adapter procedures on launch, I dont know how to make it background or which code to run to keep sending the POST data every half an hour.
It sounds like you are running on Android.
The expected behavior in Android is that pressing the Back button QUITS the application.
Moving to the background is performed by pressing the Home button.
So, I don't think you should do this when pressing the Back button... or maybe you should at least present the user the choice of either quitting or moving to the background (you can override the Back button by using WL.App.overrideBackButton).
That said, I am not familiar with a programmatic method to move to the background instead of quitting (maybe there is an existing Cordova plug-in or another way that does this).
The other way to accomplish this is by using an Android Background Service, however, Worklight does not have support in its Native API to do this.
As for what happens when the Worklight application is in the background, I have never tried it myself, so I cannot be certain at all, but try using WL.Client.setHeartBeatInterval to keep alive the connection to the Worklight Server and write some logic that sends the adapter requests. See if that would work for you...
I have found this:
How to create plugin in phonegap to run the application in background?
Maybe you'll be able to massage it into your Worklight project (in case the heartbeat approach above does not work).
More information on running in the background:
Android:
http://developer.android.com/training/basics/activity-lifecycle/index.html
http://developer.android.com/reference/android/app/Activity.html
iOS:
http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html
Override the Back button by using WL.App.overrideBackButton.,
remove the exit function in that method and leave it blank (if you want the background process not to exit when clicked)

How to hook into the close event of IE

I want to perform some clean-up in my ASP.NET web application when the user closes the IE window or the tab page in which the page is open.
I was looking at the unload event of the "body" element, however the unload event also gets fired when you click the Refresh button in IE or change the URL by typing in the address bar.
Any ideas on which event to catch to trap IE window (6.0 and 7.0) and Tab closing?
use InProc sessions, and the Session_End event in global.ascx to do your cleanup. javascript is too unreliable for this.
Javascript will be unreliable/quite restricting on this for security reasons. It really depends what you are trying to do, if you are trying to fire some code on the clients machine then this is going to be difficult/impossible (which is a good thing, I don't really want websites I don't trust messing with my browser on one of it's most core features, closing a window).
If you want to run some server side scripts to flag the user as gone, again, hard/impossible, as Jasper mentioned global.ascx will go some way as to helping you, but otherwise you will have to have timers and events fired on 'expired' users.

Resources