connected visa intl payments
This commit is contained in:
1 parent
73142c1fcf
commit
98bb2f780e
22 files changed
+593
-252
No files matched your search
@@ -307,7 +307,7 @@ export function BranchForm({ mode, initialData }: BranchFormProps) {
|
||||
|
||||
const provinceSelect: Omit<InfiniteSelectProps, "label" | "required" | "placeholder"> = useMemo(() => {
|
||||
const opts: InfiniteSelectOption[] = (provinceQuery.data?.pages ?? [])
|
||||
.flatMap((p) => p.provinces)
|
||||
.flatMap((p) => p?.provinces ?? [])
|
||||
.map((p) => ({ value: String(p.id), label: p.name[lang] }));
|
||||
|
||||
// Ensure the currently-selected province is present (edit mode), even if it
|
||||
|
||||
@@ -48,8 +48,9 @@ export function useInfiniteProvinces(search = "") {
|
||||
initialPageParam: 1,
|
||||
queryFn: ({ pageParam, signal }) => fetchProvinces({ page: pageParam, limit: PROVINCE_PAGE_SIZE, search: effectiveSearch }, signal),
|
||||
getNextPageParam: (lastPage, allPages) => {
|
||||
const loaded = allPages.reduce((sum, p) => sum + p.provinces.length, 0);
|
||||
return loaded < lastPage.count ? allPages.length + 1 : undefined;
|
||||
const loaded = allPages.reduce((sum, p) => sum + (p?.provinces?.length ?? 0), 0);
|
||||
const count = lastPage?.count ?? 0;
|
||||
return loaded < count ? allPages.length + 1 : undefined;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user