Skip to content

Commit

Permalink
fix: transition error
Browse files Browse the repository at this point in the history
  • Loading branch information
sonylomo committed Dec 3, 2024
1 parent cd7bed2 commit a30fbba
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/context/searchBlog.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import PropTypes from "prop-types";
import { createContext, useEffect, useMemo, useState } from "react";
import {
createContext,
useEffect,
useMemo,
useState,
startTransition,
} from "react";
import { useSearchBlog } from "../hooks/Queries/blogs/useAllBlogsData";

export const SearchBlogContext = createContext();
Expand All @@ -12,7 +18,9 @@ export function SearchBlogProvider({ children }) {

useEffect(() => {
const dalayDebounceFn = setTimeout(() => {
refetchSearchBlog();
startTransition(() => {
refetchSearchBlog();
});
}, 500);

return () => clearTimeout(dalayDebounceFn);
Expand Down

0 comments on commit a30fbba

Please sign in to comment.