Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lib/query/hooks/useDealsQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,14 @@ export const useAddDealItem = () => {
if (error) throw error;
return { dealId, item: data! };
},
onSuccess: (data, { dealId }) => {
queryClient.setQueryData(DEALS_VIEW_KEY, (old) => {
if (!old) return old;
return old.map((d) =>
d.id === dealId ? { ...d, items: [...(d.items ?? []), data.item] } : d
);
});
},
onSettled: (_data, _error, { dealId }) => {
queryClient.invalidateQueries({ queryKey: queryKeys.deals.detail(dealId) });
queryClient.invalidateQueries({ queryKey: queryKeys.deals.lists() });
Expand All @@ -536,6 +544,14 @@ export const useRemoveDealItem = () => {
if (error) throw error;
return { dealId, itemId };
},
onSuccess: (data) => {
queryClient.setQueryData(DEALS_VIEW_KEY, (old) => {
if (!old) return old;
return old.map((d) =>
d.id === data.dealId ? { ...d, items: (d.items ?? []).filter((i) => i.id !== data.itemId) } : d
);
});
},
onSettled: (_data, _error, { dealId }) => {
queryClient.invalidateQueries({ queryKey: queryKeys.deals.detail(dealId) });
queryClient.invalidateQueries({ queryKey: queryKeys.deals.lists() });
Expand Down
2 changes: 1 addition & 1 deletion vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"crons": [
{ "path": "/api/cron/daily-briefing", "schedule": "0 8 * * 1-5" },
{ "path": "/api/cron/template-sync", "schedule": "0 6 * * *" },
{ "path": "/api/cron/stage-evaluations", "schedule": "* * * * *" }
{ "path": "/api/cron/stage-evaluations", "schedule": "0 0 * * *" }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Revert cron frequency; daily scheduling delays stage advancement too much.

At Line 13, changing /api/cron/stage-evaluations from every minute to once per day introduces up to ~24h latency for queued stage evaluations, which regresses deal advancement freshness and can accumulate backlog (app/api/cron/stage-evaluations/route.ts:1-19, lib/ai/agent/agent.service.ts:669-690).

Suggested fix
-    { "path": "/api/cron/stage-evaluations", "schedule": "0 0 * * *" }
+    { "path": "/api/cron/stage-evaluations", "schedule": "* * * * *" }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{ "path": "/api/cron/stage-evaluations", "schedule": "0 0 * * *" }
{ "path": "/api/cron/stage-evaluations", "schedule": "* * * * *" }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@vercel.json` at line 13, The cron for the stage evaluations endpoint was
changed to daily, causing up to 24h latency for queued evaluations; revert the
schedule for the "/api/cron/stage-evaluations" entry back to a per-minute
cadence (e.g., "*/1 * * * *") so stage advancement runs frequently and avoids
backlog; update vercel.json's cron entry that references
"/api/cron/stage-evaluations" accordingly and ensure the change aligns with the
route handler at app/api/cron/stage-evaluations/route.ts and the evaluation
logic in lib/ai/agent/agent.service.ts.

]
}