hamzahamidi / ajsf

Angular JSON Schema Form
https://hamzahamidi.github.io/ajsf
MIT License
362 stars 183 forks source link

Seeing thousands of "ERROR TypeError: Cannot read property 'removable' of undefined" errors #228

Open benrebak opened 4 years ago

benrebak commented 4 years ago

My console fills up with thousands of error messages with the type error mentioned in the title.

which template:

To Reproduce Steps to reproduce the behavior:

As far as I'm aware, all that's required in order to reproduce it is the following:

  <json-schema-form loadExternalAssets="true" [schema]="null" [(data)]="currentData"
    framework="bootstrap-4" (onSubmit)="replaceExistingMessage($event)">
  </json-schema-form>

Expected behavior No errors

Screenshots image

Desktop (please complete the following information):

ERROR TypeError: Cannot read property 'removable' of undefined
    at Bootstrap4FrameworkComponent.get showRemoveButton [as showRemoveButton] (vendor.js:115)
    at Object.updateDirectives (vendor.js:54)
    at Object.debugUpdateDirectives [as updateDirectives] (vendor.js:73905)
    at checkAndUpdateView (vendor.js:72917)
    at callViewAction (vendor.js:73283)
    at execComponentViewsAction (vendor.js:73211)
    at checkAndUpdateView (vendor.js:72924)
    at callViewAction (vendor.js:73283)
    at execEmbeddedViewsAction (vendor.js:73240)
    at checkAndUpdateView (vendor.js:72918)
benrebak commented 4 years ago

I can avoid this by changing [schema]="null" to [schema]="mySchema", adding *ngIf="mySchema != null" to the <json-schema-form /> component. But if I do this, then the styling from Bootstrap isn't applied until I enable the form (by setting the value of mySchema). This means the look and feel of the page changes completely when I select a schema, including text resizing

benrebak commented 4 years ago

This can be reliably reproduced on https://hamidihamza.com/ajsf/ by setting framework to Bootstrap 4, and setting Input JSON Schema and Form Layout to:

{
  "schema": {
  }
}
benrebak commented 4 years ago

Workaround is that the schema must be defined as:

mySchema = {
    type: 'object',
    properties: {}
}
benrebak commented 4 years ago

@hamzahamidi

github-actions[bot] commented 4 years ago

Stale issue