Skip to content

Conversation

dkarkanas
Copy link

When we are using json schema form with the following sytnax, we realized the UI was lagging because of an infinite loop triggered/triggering ngOnChanges.

<json-schema-form
                    [schema]="schema"
                    [(data)]="data"
                    [layout]="layout"
                    [framework]="framework"
                    [options]="jsonFormOptions"
                    [widgets]="widgets"
                    (onChanges)="onFormChanges($event)"
                    (isValid)="isValid($event)"
                    (onSubmit)="onSubmit($event)">
</json-schema-form>

Adding a condition for checking the equality of previous and current value, fixes the infinite loop.

if (changes.data && isEqual(changes.data.previousValue, changes.data.currentValue)) {      
      return;
}

@netlify
Copy link

netlify bot commented Aug 11, 2022

Deploy Preview for ajsf ready!

Name Link
🔨 Latest commit 89de387
🔍 Latest deploy log https://app.netlify.com/sites/ajsf/deploys/62f4bdaa5fab3d0008ee0185
😎 Deploy Preview https://deploy-preview-326--ajsf.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@dkarkanas dkarkanas marked this pull request as draft August 11, 2022 08:30
@dkarkanas dkarkanas marked this pull request as ready for review August 11, 2022 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant