react-jsonschema-form formData doesn't update after redux update - react-jsonschema-forms

i have a problem with rjsf after updating redux from v. 7.2.0 to 8.0.2 , and updated react to v18 . The problem is, it doesn't update one of the fields in formData. after calling formChange, formData is correct but it's called again and formData has the old data for that field.

Related

Will next.js 13 new getData() functions work with Prisma and postgres

Next JS 13 introduced a new way to get data for components. This is sort of a combination of server-side and client-side props. When the feature was completely new there was a note about it not working when fetching data from databases, but I can’t see anything about that on the page anymore. Is it now possible to use the new getData function with Prisma and Postgres?

How to determine the last called action in NgRx?

Is it possible to determine the last called action in an Angular/Redux project in the code so that I can react on it in the observer? Currently I am using a property in my redux store which is set to the current name of the action in the corresposonging reducer, but is there an easier way to do this?

Symfony - Creating or Editing a form depending on the button pressed

I am creating a form which when saved, updates the current and any related entities (simple!) when I edit that, I have two buttons, 'Update Existing Version' or 'Create New Version'
If I click on create new version it basically needs to create everything within the form as a brand new version (a copy of the existing one but with a version integer increased by one) whereas if I click update its happy to just update the existing entity.
In Symfony the form is created with $this->createForm(<class>, <data>) and if I pass a new class entity to data then it'll create a new one and if I pass in an existing entity it will update.
However, I don't know until after I've handled the request whether the form is for a new version or to update current version as it comes from the button, which means the form is already created and initialized.
If it is a new version I also need to somehow update all of the related entities to the new version.
I think this should be relatively simple and I'm missing something obvious.
I'm using Symfony form collection to generate the form.
Can anyone help?
Thanks
Kevin
Just in case people come across this.
I simply checked within the form processing for which button was pressed, then just cloned the entity.
I then created a __clone function within the entity that dealt with the relationships it had (basically looped through the related entities, cloned them and changed the parent to $this).
That was it, everything else worked as normal

how to display fetch data form firebase in backbone?

I am learning backbone.js. I am using firebase for API. I can't able to display data. Can anyone help me please?
I follow instruction mention on https://github.com/firebase/backbonefire.
var realtimeList = new RealtimeList();
realtimeList.on('sync', function(collection) {
console.log('collection is loaded ', collection);
// todoView.render();
});
Collection is object.
DEMO
Your view element is not part of DOM. You need to add it to DOM. I've used el property to do so for the sake of demo.
Also you need to stringify the JavaScript object returned by toJSON() to display in DOM.
Updated demo.
Your API is returning empty collection at the moment so I've used the todoItem model created locally for demo. But it isn't part of the Firebase collection. You need to pass the collection to view and render the models inside it in order to view realtime data.

Understanding the purpose of the ngrx router-store project as compared to only using the angular 2 router

I am in reference to the router-store ngrx project (https://github.com/ngrx/router-store).
I am not clear how to use this project...
For instance let's take the following sample from the project documentation:
store.dispatch(go(['/path', { routeParam: 1 }], { query: 'string' }));
Is this meant to be use as a replacement to the angular 2 router: router.navigate(['/path...?
...or should I use the ngrx router-store only in certain circumstances? (if so which ones?)
Also what happens to the ngrx router-store when a angular 2 router html link e.g. <a routerLink="/heroes" is clicked?
More generally, can someone please explain what is achieved by the ngrx router-store project as compared to using the plain angular 2 router?
Or to rephrase, what does ngrx router-store brings in addition to the angular 2 router?
Edit: An interesting source of information and samples about ngrx is of course the ngrx example-app (https://github.com/ngrx/example-app).
I found a dependency to the router-store there but I have not been able to find where the router-store is used within the app...
FYI, here is the comment to be found in the example app about the router store:
#ngrx/router-store keeps router state up-to-date in the store and
uses the store as the single source of truth for the router's state.
The #ngrx/router-store exists so that it's possible for the store to be the single source of truth for an application's routing state.
Without it, there would be application state - the current route - not represented in the store. That means time-travel debugging using the DevTools would not be possible, as there would be no state in the store representing the route and there would be no actions representing route changes.
The router-store does not replace the Angular router; it just wires up listeners for routing actions and for the router itself.
When you emit a routing action using the go action creator, a "[Router] Go" action containing the specifed path is heard by the router-store which then calls the corresponding router method. When the router-store hears - from the router - that the route has changed it emits a "[Router] Update Location" action representing the route change and that action sees the router state in the store updated.
If, instead of using the go action creator, a routerLink is used to effect a route change, router-store will hear the change and will emit a "[Router] Update Location" action that will see the store's router state updated.
So, whether the route is changed via actions or more traditional links, the store always contains the router state.
With the "[Router] Update Location" actions representing route changes, you can undo said route changes via the DevTools - something that would not be possible if the router state were not represented in the store.
If you've not used the Redux DevTools, I would recommend you check them out:
Redux DevTools Extension
#ngrx/store-devtools
#ngrx/store-log-monitor
An example.
Say you have a selected id that you pass in the router state. That id references a customer.
Your url looks something like this: myapp.com/customers/7755664
When you route to the customer edit view, you can write a selector that gets the customer entity using the id from the router state. Say you want to scroll through the customers. You navigate to myapp.com/customers/7755653. The selector returns the customer, the select call emits and your view rerenders with the new customer.
It simplifies selectors and replaces the need to have a selectedcustomer property in your state.

Resources