Browse Source

fix: coderabbit suggestion and passing args correctly

pull/8732/head
Pranav C 5 months ago
parent
commit
7861461977
  1. 4
      packages/nc-gui/composables/useDebounceFnCached.ts

4
packages/nc-gui/composables/useDebounceFnCached.ts

@ -26,9 +26,9 @@ export function useCachedDebouncedFunction<T extends FunctionArgs>(
// Cache to store debounced functions based on a unique key // Cache to store debounced functions based on a unique key
const debounceCache = new Map<string | number, any>() const debounceCache = new Map<string | number, any>()
return function (...args: Parameters<T>): ReturnType<T> { return (...args: Parameters<T>): ReturnType<T> => {
// Generate a unique key for the given arguments // Generate a unique key for the given arguments
const key = getCacheKey(args) const key = getCacheKey(...args)
// If the debounced function for the given key is not in the cache, create and cache it // If the debounced function for the given key is not in the cache, create and cache it
if (!debounceCache.has(key)) { if (!debounceCache.has(key)) {

Loading…
Cancel
Save