Skip to content

Commit

Permalink
ensure all timeout -> hook
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Oct 7, 2024
1 parent 79d3715 commit 8458f6d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 29 deletions.
19 changes: 3 additions & 16 deletions web/src/app/admin/connector/[ccPairId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,8 @@ function Main({ ccPairId }: { ccPairId: number }) {
const { popup, setPopup } = usePopup();

const finishConnectorDeletion = useCallback(() => {
setPopup({
message: "Connector deleted successfully",
type: "success",
});
setTimeout(() => {
router.push("/admin/indexing/status");
}, 2000);
}, [router, setPopup]);
router.push("/admin/indexing/status?message=connector-deleted");
}, [router]);

useEffect(() => {
if (isEditing && inputRef.current) {
Expand All @@ -80,14 +74,7 @@ function Main({ ccPairId }: { ccPairId: number }) {
) {
finishConnectorDeletion();
}
}, [
isLoading,
ccPair,
error,
hasLoadedOnce,
router,
finishConnectorDeletion,
]);
}, [isLoading, ccPair, error, hasLoadedOnce]);

const handleNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setEditableName(e.target.value);
Expand Down
29 changes: 16 additions & 13 deletions web/src/app/admin/indexing/status/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ import { useConnectorCredentialIndexingStatus } from "@/lib/hooks";
import { usePopupFromQuery } from "@/components/popup/PopupFromQuery";

function Main() {
const { popup } = usePopupFromQuery({
"connector-created": {
message: "Connector created successfully",
type: "success",
},
});
const {
data: indexAttemptData,
isLoading: indexAttemptIsLoading,
Expand Down Expand Up @@ -70,19 +64,28 @@ function Main() {
});

return (
<>
{popup}
<CCPairIndexingStatusTable
ccPairsIndexingStatuses={indexAttemptData}
editableCcPairsIndexingStatuses={editableIndexAttemptData}
/>
</>
<CCPairIndexingStatusTable
ccPairsIndexingStatuses={indexAttemptData}
editableCcPairsIndexingStatuses={editableIndexAttemptData}
/>
);
}

export default function Status() {
const { popup } = usePopupFromQuery({
"connector-created": {
message: "Connector created successfully",
type: "success",
},
"connector-deleted": {
message: "Connector deleted successfully",
type: "success",
},
});

return (
<div className="mx-auto container">
{popup}
<AdminPageTitle
icon={<NotebookIcon size={32} />}
title="Existing Connectors"
Expand Down

0 comments on commit 8458f6d

Please sign in to comment.