Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rjsf): remove debounce #77

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions packages/app/components/jsonschemaform/jsonschemaform.tsx
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removes debounce and its documentation.

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
Loading