mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-25 18:06:15 -04:00
Feat/admin react (#6211)
* Added vite react admin ui. * Added react i18next. * Added pads manager. * Fixed docker build. * Fixed windows build. * Fixed installOnWindows script. * Install only if path exists.
This commit is contained in:
parent
d34b964cc2
commit
db46ffb63b
112 changed files with 3327 additions and 946 deletions
22
admin/src/utils/useDebounce.ts
Normal file
22
admin/src/utils/useDebounce.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import {DependencyList, EffectCallback, useMemo, useRef} from "react";
|
||||
import {useAnimationFrame} from "./AnimationFrameHook";
|
||||
|
||||
const defaultDeps: DependencyList = []
|
||||
|
||||
export const useDebounce = (
|
||||
fn:EffectCallback,
|
||||
wait = 0,
|
||||
deps = defaultDeps
|
||||
):void => {
|
||||
const isFirstRender = useRef(true)
|
||||
const render = useAnimationFrame(fn, wait)
|
||||
|
||||
useMemo(()=>{
|
||||
if(isFirstRender.current){
|
||||
isFirstRender.current = false
|
||||
return
|
||||
}
|
||||
|
||||
render()
|
||||
}, deps)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue