Skip to content

Commit

Permalink
fix: avoid more duplicate requests
Browse files Browse the repository at this point in the history
  • Loading branch information
mguellsegarra committed Nov 2, 2024
1 parent ff4bf9b commit d4c3a00
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/actionbar/TreeActionBar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContext, useEffect, useState } from "react";
import { useContext, useEffect, useState, useRef } from "react";
import { Space, Spin } from "antd";
import ChangeViewButton from "./ChangeViewButton";
import {
Expand Down Expand Up @@ -78,6 +78,7 @@ function TreeActionBar(props: Props) {
) as ContentRootContextType;
const { processAction } = contentRootContext || {};
const [exportModalVisible, setExportModalVisible] = useState(false);
const isFirstMount = useRef(true);

useHotkeys(
"ctrl+l,command+l",
Expand Down Expand Up @@ -108,6 +109,11 @@ function TreeActionBar(props: Props) {

useEffect(() => {
if (isInfiniteTree && searchTreeNameSearch === undefined) {
if (isFirstMount.current) {
isFirstMount.current = false;
return;
}

searchTreeRef?.current?.refreshResults();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down

0 comments on commit d4c3a00

Please sign in to comment.