Skip to content

Commit

Permalink
refactor: make the debounceMs zero by default
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Jan 16, 2025
1 parent 09b4fd9 commit ef9c737
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/collections/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface FilterOptions {
}

export function useDefaultFilter(options: FilterOptions = {}) {
const { caseSensitive = false, debounceMs = 100 } = options;
const { caseSensitive = false, debounceMs = 0 } = options;

const withCaseSensitive = caseSensitive ? (value: string) => value : (value: string) => value.toLowerCase();

Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,10 @@ export function fromNumberish(value: MaybeRefOrGetter<Numberish | undefined>): n

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function debounce<TFunction extends (...args: any[]) => any>(ms: number, fn: TFunction) {
if (ms <= 0) {
return fn;
}

let timer: number | null = null;

return function (...args: Parameters<TFunction>) {
Expand Down

0 comments on commit ef9c737

Please sign in to comment.