@equinor/fusion
Advanced tools
Comparing version 0.1.80 to 0.1.81
export declare type PropertyAccessorFunction<T> = (item: T) => string | null; | ||
export declare type PropertyAccessor<T> = keyof T | PropertyAccessorFunction<T>; | ||
export declare type SortDirection = "asc" | "desc"; | ||
export declare const applySorting: <T>(data: readonly T[], sortBy?: PropertyAccessorFunction<T> | keyof T | null, direction?: "desc" | "asc" | null) => readonly T[]; | ||
declare const _default: <T>(data: readonly T[], defaultSortBy?: PropertyAccessorFunction<T> | keyof T | null, defaultDirection?: "desc" | "asc" | null) => { | ||
sortedData: readonly T[]; | ||
export declare const applySorting: <T>(data: T[], sortBy?: PropertyAccessorFunction<T> | keyof T | null, direction?: "desc" | "asc" | null) => T[]; | ||
declare const _default: <T>(data: T[], defaultSortBy?: PropertyAccessorFunction<T> | keyof T | null, defaultDirection?: "desc" | "asc" | null) => { | ||
sortedData: T[]; | ||
sortBy: PropertyAccessorFunction<T> | keyof T | null; | ||
@@ -8,0 +8,0 @@ direction: "desc" | "asc" | null; |
@@ -97,4 +97,8 @@ import { useState, useEffect, useCallback } from "react"; | ||
const [pagination, setPagination] = useState(createPagination(0, perPage, currentPageIndex, padding)); | ||
useEffect(() => { | ||
setPagedData([]); | ||
setPagination(createPagination(pagination.totalCount, perPage, currentPageIndex, padding)); | ||
}, [currentPageIndex, perPage, ...deps]); | ||
const abortable = withAbortController(); | ||
const applyPaginationAsync = () => { | ||
useEffect(() => { | ||
setIsFetching(true); | ||
@@ -116,8 +120,3 @@ return abortable(async (signal) => { | ||
}); | ||
}; | ||
useEffect(() => { | ||
setPagedData([]); | ||
setPagination(createPagination(pagination.totalCount, perPage, currentPageIndex, padding)); | ||
return applyPaginationAsync(); | ||
}, [currentPageIndex, perPage, ...deps]); | ||
}, [pagination]); | ||
const setCurrentPage = useCallback((index, perPage) => { | ||
@@ -124,0 +123,0 @@ setCurrentPageIndex(index); |
{ | ||
"name": "@equinor/fusion", | ||
"version": "0.1.80", | ||
"version": "0.1.81", | ||
"description": "Everything a Fusion app needs to communicate with the core", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
149915
3553