Skip to content

Commit c457646

Browse files
committed
Fix Angular issues
1 parent ed67367 commit c457646

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

packages/angular/src/abstract-control.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import { Subscription } from 'rxjs';
4343
import { JsonFormsBaseRenderer } from './base.renderer';
4444
import { JsonFormsAngularService } from './jsonforms.service';
4545
import merge from 'lodash/merge';
46+
import { isEqual } from 'lodash';
4647
@Component({
4748
template: ''
4849
})
@@ -126,7 +127,9 @@ export abstract class JsonFormsAbstractControl<
126127
this.scopedSchema !== undefined ? this.scopedSchema.description : '';
127128
this.id = props.id;
128129
this.form.setValue(data);
129-
this.propsPath = path;
130+
if (!isEqual(this.propsPath, path)) {
131+
this.propsPath = path;
132+
}
130133
this.mapAdditionalProps(props);
131134
}
132135
});

packages/angular/src/control.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export class JsonFormsControl
3737
implements OnInit, OnDestroy {
3838
protected mapToProps(state: JsonFormsState): StatePropsOfControl {
3939
const props = mapStateToControlProps(state, this.getOwnProps());
40+
console.log("mapStateToProps", props);
4041
return { ...props };
4142
}
4243
}
@@ -46,6 +47,7 @@ export class JsonFormsControlWithDetail
4647
implements OnInit, OnDestroy {
4748
protected mapToProps(state: JsonFormsState): StatePropsOfControlWithDetail {
4849
const props = mapStateToControlWithDetailProps(state, this.getOwnProps());
50+
console.log("mapStateToControlWithDetailProps", props);
4951
return { ...props };
5052
}
5153
}

packages/angular/src/jsonforms.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const areEqual = (prevProps: StatePropsOfJsonFormsRenderer, nextProps: StateProp
5757
&& get(prevProps, 'uischemas.length') === get(nextProps, 'uischemas.length')
5858
&& get(prevProps, 'schema') === get(nextProps, 'schema')
5959
&& isEqual(get(prevProps, 'uischema'), get(nextProps, 'uischema'))
60-
&& get(prevProps, 'path') === get(nextProps, 'path');
60+
&& isEqual(get(prevProps, 'path'), get(nextProps, 'path'));
6161
};
6262

6363
@Directive({
@@ -78,7 +78,9 @@ export class JsonFormsOutlet extends JsonFormsBaseRenderer<UISchemaElement>
7878

7979
@Input()
8080
set renderProps(renderProps: OwnPropsOfRenderer) {
81-
this.path = renderProps.path;
81+
if (!isEqual(this.path, renderProps.path)) {
82+
this.path = renderProps.path;
83+
}
8284
this.schema = renderProps.schema;
8385
this.uischema = renderProps.uischema;
8486
this.update(this.jsonformsService.getState());

0 commit comments

Comments
 (0)