feat(i18n): add "save_changes" translations for English and Indonesian

fix(validation): improve Indonesian validation messages for clarity

refactor(ui): optimize useAsyncPaginate hook for better readability

fix(data-table): enhance error handling with detailed messages in EnterpriseDataTable

feat(enterprise-module): add form control to EnterpriseFormPageConfig and implement save confirmation modal

refactor(form-page): streamline form page context and improve save handling logic

feat(index-page): set document title based on config or translation key

refactor(module-provider): clean up comments and improve code organization
This commit is contained in:
Firman Ramdhani
2026-07-27 11:14:15 +07:00
parent b332da4808
commit e55c33069b
18 changed files with 776 additions and 363 deletions
@@ -78,12 +78,7 @@ export interface UseAsyncPaginateReturn<T> {
export function useAsyncPaginate<T extends Record<string, any>>(
options: UseAsyncPaginateOptions<T>,
): UseAsyncPaginateReturn<T> {
const {
loadOptions,
valueKey,
debounceMs = 300,
defaultOptions,
} = options;
const { loadOptions, valueKey, debounceMs = 300, defaultOptions } = options;
// -----------------------------------------------------------------------
// State
@@ -191,9 +186,7 @@ export function useAsyncPaginate<T extends Record<string, any>>(
// If the API returned items but ALL were duplicates, treat as exhausted.
// This prevents infinite scroll loops on naive APIs that ignore pagination.
const effectiveHasMore = newItems.length > 0 && newUniqueCount === 0
? false
: hasMore;
const effectiveHasMore = newItems.length > 0 && newUniqueCount === 0 ? false : hasMore;
setCache((prev) => {
const next = new Map(prev);
@@ -235,7 +228,7 @@ export function useAsyncPaginate<T extends Record<string, any>>(
// on every cache update. Instead, we read cache inside via the state setter's prev.
// The `cache.get(searchTerm)` read above is for prevOptions passed to loadOptions —
// this is acceptable because the callback is only called when we're NOT already fetching.
// eslint-disable-next-line react-hooks/exhaustive-deps
[],
);
@@ -259,7 +252,6 @@ export function useAsyncPaginate<T extends Record<string, any>>(
// No cache entry — fetch page 1
fetchPage(debouncedSearch, 1);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [debouncedSearch]);
// -----------------------------------------------------------------------