Skip to content

Commit

Permalink
debounce query to 2 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr.suwala committed Jun 21, 2024
1 parent f96ee09 commit 41f8b5a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions froncik/components/Images.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React, {useCallback, useContext, useEffect, useState} from "react";
import _ from "lodash";
import {TemplatesContext} from "./teplatesStore";


const debounceTime = 2000;
export default function Images({id, fields}: { id: number, fields: Record<string, string> }) {

const [images, loadImages] = useState<undefined | string[]>(undefined)
Expand All @@ -14,7 +14,7 @@ export default function Images({id, fields}: { id: number, fields: Record<string
const debouncedQuery = useCallback(_.debounce((fun) =>
ctx.withLoading(() =>
fun()
), 400
), debounceTime
), [])

useEffect(() => {
Expand Down
1 change: 0 additions & 1 deletion froncik/pages/template/print/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ type QueryParams = {
};

type Props = {};
const debounceDelay = 1000; //ms

export default function Print({}: Props) {
const router = useRouter();
Expand Down

0 comments on commit 41f8b5a

Please sign in to comment.