Skip to content

Commit

Permalink
Merge pull request #77 from nasa/fix/MEDITOR-844-resolve-sluggish-inp…
Browse files Browse the repository at this point in the history
…ut-text

fix(rjsf): remove debounce
  • Loading branch information
benforshey authored Jan 28, 2025
2 parents 5817f78 + a41cb0c commit d219fa8
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions packages/app/components/jsonschemaform/jsonschemaform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ class LargeModelForm<
}
}

static debounce(fn: Function, delay = 600) {
let timerId: NodeJS.Timeout

return (...args: any[]) => {
globalThis.clearTimeout(timerId)

timerId = setTimeout(() => fn(...args), delay)
}
}

/*
* Targeting only nodes in our allowlist, we conditionally stop propagation so that the ajv8 validator does not get triggered.
* We state lock the event so that later logic does not propagate its change event.
Expand Down Expand Up @@ -108,9 +98,8 @@ class LargeModelForm<
* Targeting only nodes in our allowlist, we check to make sure node's event has been stored.
* Because the ajv8 validator is slow on large schemas, we wait until the `blur` event before triggering an update.
* We mark the node as ready to propagate, re-dispatching the event.
* Debounce this handler for rapid tabbing, which triggers unnecessary state updates.
*/
handleBlur = LargeModelForm.debounce((event: any) => {
handleBlur = (event: any) => {
if (
this.targetNodeNames.includes(event.target.nodeName) &&
this.eventStore[event.target.id]
Expand All @@ -121,7 +110,7 @@ class LargeModelForm<
this.eventStore[event.target.id]
)
}
})
}
}

const JsonSchemaForm = ({
Expand Down

0 comments on commit d219fa8

Please sign in to comment.