@lenne.tech/ng-base 14.2.3 → 14.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1028,14 +1028,10 @@ class ModelFormComponent {
1028
1028
  });
1029
1029
  }
1030
1030
  ngOnChanges(changes) {
1031
- // Reinit form for new model
1032
- if (changes['modelName']) {
1031
+ // Reinit form for new model or load and patch form with new id
1032
+ if (changes['modelName'] || changes['id']) {
1033
1033
  this.init();
1034
1034
  }
1035
- // Load and patch form with new id
1036
- if (changes['id']) {
1037
- this.getObjectById(this.id);
1038
- }
1039
1035
  }
1040
1036
  /**
1041
1037
  * > If the model name and metadata are present, set the operation to update or create, get the fields from the
@@ -1078,6 +1074,9 @@ class ModelFormComponent {
1078
1074
  * @param id - The id of the object to be loaded
1079
1075
  */
1080
1076
  getObjectById(id) {
1077
+ if (!id) {
1078
+ return;
1079
+ }
1081
1080
  if (this.logging) {
1082
1081
  console.log('ModelFormComponent::getObjectById->id', id);
1083
1082
  console.log('ModelFormComponent::getObjectById->requestFields', this.createRequestObject(this.fields));