attempt to fix job-list reload bug

This commit is contained in:
Ramnique Singh 2025-08-13 11:56:35 +05:30
parent c94f96fb32
commit 6b49872154
2 changed files with 5 additions and 3 deletions

View file

@ -1,6 +1,6 @@
'use client'; 'use client';
import { useEffect, useState } from "react"; import { useEffect, useMemo, useState } from "react";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Panel } from "@/components/common/panel-common"; import { Panel } from "@/components/common/panel-common";
@ -20,6 +20,8 @@ export function RecurringJobRuleView({ projectId, ruleId }: { projectId: string;
const [deleting, setDeleting] = useState(false); const [deleting, setDeleting] = useState(false);
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false); const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
const jobsFilters = useMemo(() => ({ recurringJobRuleId: ruleId }), [ruleId]);
useEffect(() => { useEffect(() => {
const loadRule = async () => { const loadRule = async () => {
try { try {
@ -272,7 +274,7 @@ export function RecurringJobRuleView({ projectId, ruleId }: { projectId: string;
</h3> </h3>
<JobsList <JobsList
projectId={projectId} projectId={projectId}
filters={{ recurringJobRuleId: ruleId }} filters={jobsFilters}
showTitle={false} showTitle={false}
/> />
</div> </div>

View file

@ -50,7 +50,7 @@ export function JobsList({ projectId, filters, showTitle = true, customTitle }:
setLoading(false); setLoading(false);
})(); })();
return () => { ignore = true; }; return () => { ignore = true; };
}, [fetchPage, filters]); }, [fetchPage]);
const loadMore = useCallback(async () => { const loadMore = useCallback(async () => {
if (!cursor) return; if (!cursor) return;