This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { QueryBuilder } from 'knex'; | |
import zip from './zip'; | |
export interface Page { | |
items: any[]; | |
hasNext: boolean; | |
hasPrevious: boolean; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
/** | |
* Hide loading states from the user unless they exceed a minimum of `wait` ms, and | |
* once shown, display them for a minimum of `minLength` ms. | |
*/ | |
export function usePending(loading: boolean, wait = 0, minLength: number = 0) { | |
let [, forceRender] = React.useState<any>(); | |
// The buffered loading value |