redux state and page refresh - redux

Is there a way to persist redux state within react-admin ?
Each time a user reload a page in the browser, filters and custom reducers are lost. How to customize react-admin to persist redux state (like redux-persist and redux-storage)?

Related

Updating Apollo cache after fetching data on server-side

I spent 4 days in an attempt to get Apollo working with my Next.js app — and encountered a huge dilemma, as it seems.
Here's a very clear and understandable example for React SPA. This is how we update cache using mutation hook.
The mutation hook works with "todos" fields. Here's the excerpt:
fields: {
todos(existingTodos = []) {
This implies that a query has been made before. The data was fetched via GraphQL query on the client-side. And the todos data has been cached as "todos" collection (or field rather).
So, with React SPA it is trivial to update the cache. And the work is easy and straightforward.
Dilemma
In my Next.js app I fetch data on server-side in getServerSideProps() method. The fetched data is passed further to the Page Component as props.
When I perform a mutation on client-side — it's a different, an in-browser Apollo Client instance that doesn't have the cached data. Because that data was fetched using server-side instance.
If it's not possible to access the Apollo server-side cache from the client-side (browser) — can someone recommend a workaround of how to go about Apollo with Next.js?

Update table data in angular 6 site without refreshing state when data update in firebase

I am developing angular 6 site. it's fetching data from firebase firestore and display on table.
But if site is already load and I have fetch data and display on table after that If I delete or update record in firebase directly then Can I get that immediate reflection on web table
Is it possible with observable of angular firebase like AngularFirestore ?
Your client needs event to act on, it cannot be automatically without event to trigger, you can use some scheduler or maybe with setTimeout to pull the data and refresh your table, if you have control on that external site you can push notification from it to your server side, then trigger that from your client to get the data refreshed.

How to update vuex store based on firestore change

I have a vuejs, vuex, firestore app that stores user state using vuex. All is working fine, however, I have a feature where a user submits a job to an aws lambda which takes a little while to process.
The lambda does its thing, and when it's done it updates a field on the user's document in firestore. My app needs to reload the user's state into my vuex store, but I don't know how to listen or trigger that action within my app, as the user will submit the long running job and then go on their way.
How can I have my vuejs app be notified that the single document's field has been updated at firestore so I can dispatch and re-load my vuex state?

Replaying actions in Redux devtools will generate new actions with RxJS

So basically My Angular2 application is using ngrx and rxjs. And also I'm using Redux DevTools chrome extention for debugging purpose.
The thing is when I tried to replay all the actions in Redux DevTools, it always generates new actions automatically. I think the reason is because I'm using a lot of Observables and Subscriptions from rxjs to listen to any store updates and dispatch new actions based on that, and since replaying actions will update the store, it will trigger all those subscriptions. So my question is, is it possible to prevent new actions being generated from replaying actions?

Can I add a listener or a trigger to AsyncStorage?

I am currently writing react-native for a Chat feature for my app.
I am using Firebase as the mailBox. Since I don't want to save chat data on our database, I decided to save messages to the AsyncStorage, the device database.
So, the steps are like this:
1) User B's device listening to his mailBox changes on Firebase
2) User A send message to User B mailBox on Firebase
3) User B received the new message, because of Firebase listener
4) User B's device save the new message to AsyncStorage
5) User B's device detected changes on AsyncStorage and update the UI of Chat
Come to here, I need a listener to listen to the AsyncStorage changes so that the UI can be updated accordingly.
This come to the topic:
Can I add listener or a trigger, like DB trigger in Oracle database, to AsyncStorage?
Also, I would also like to know whether I should save users' messages in my server database. Thanks
I am not sure about the listener for async storage but a good alternative to your problem would be redux.
You can use redux for this purpose. Update the redux with the result when you are updating the Async Storage.
Make a common function that syncs your async storage and redux both. So whenever you make any change in async storage that will automatically get synced in redux as well.
Just connect the component with the redux state.
So as changes are synced in redux so the ui will change automatically because your component is connected to redux.

Resources