fix(renderer): remove app hook dependency suppressions
This commit is contained in:
1 parent
a7934d2111
commit
0235bc9b0d
1 file changed
+14
-12
+14
-12
@@ -53,9 +53,13 @@ export function App() {
|
|||||||
|
|
||||||
const showCustomTitleBar = window.agentCompany.platform !== "darwin";
|
const showCustomTitleBar = window.agentCompany.platform !== "darwin";
|
||||||
const isMac = !showCustomTitleBar;
|
const isMac = !showCustomTitleBar;
|
||||||
|
const currentCompany = company.currentCompany;
|
||||||
|
const companyRuns = company.runs;
|
||||||
|
const refreshCompany = company.refresh;
|
||||||
|
const openPathWithFeedback = company.openPathWithFeedback;
|
||||||
|
|
||||||
const startRun = useCallback(async (taskId: string) => {
|
const startRun = useCallback(async (taskId: string) => {
|
||||||
if (!company.currentCompany) {
|
if (!currentCompany) {
|
||||||
setError(createAppErrorNotice(
|
setError(createAppErrorNotice(
|
||||||
"Select a company before starting a run.",
|
"Select a company before starting a run.",
|
||||||
"COMPANY_REQUIRED",
|
"COMPANY_REQUIRED",
|
||||||
@@ -63,24 +67,22 @@ export function App() {
|
|||||||
));
|
));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const result = await window.agentCompany.startTaskRun({ companyId: company.currentCompany.id, taskId });
|
const result = await window.agentCompany.startTaskRun({ companyId: currentCompany.id, taskId });
|
||||||
if (!result.ok) { setError(formatDesktopResultNotice(result.error)); return; }
|
if (!result.ok) { setError(formatDesktopResultNotice(result.error)); return; }
|
||||||
setSelectedRunId(result.data);
|
setSelectedRunId(result.data);
|
||||||
await company.refresh();
|
await refreshCompany();
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps -- Zustand setters and company.refresh are stable
|
}, [currentCompany, refreshCompany, setError, setSelectedRunId]);
|
||||||
}, [company.currentCompany, company.refresh]);
|
|
||||||
|
|
||||||
const cancelRun = useCallback(async (runId: string) => {
|
const cancelRun = useCallback(async (runId: string) => {
|
||||||
try {
|
try {
|
||||||
const run = company.runs.find((entry) => entry.id === runId);
|
const run = companyRuns.find((entry) => entry.id === runId);
|
||||||
if (!run) throw new Error("Selected run is no longer available.");
|
if (!run) throw new Error("Selected run is no longer available.");
|
||||||
const result = await window.agentCompany.cancelRun({ companyId: run.companyId, runId });
|
const result = await window.agentCompany.cancelRun({ companyId: run.companyId, runId });
|
||||||
if (!result.ok) { setError(formatDesktopResultNotice(result.error)); return; }
|
if (!result.ok) { setError(formatDesktopResultNotice(result.error)); return; }
|
||||||
await company.refresh();
|
await refreshCompany();
|
||||||
setError(null);
|
setError(null);
|
||||||
} catch (err) { setError(describeDesktopError(err)); }
|
} catch (err) { setError(describeDesktopError(err)); }
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps -- setError is a stable Zustand setter
|
}, [companyRuns, refreshCompany, setError]);
|
||||||
}, [company.refresh, company.runs]);
|
|
||||||
|
|
||||||
const { filteredNavItems, matchedAgents, matchedTasks, matchedRuns, matchedGoals, matchedProjects, hasEntityResults } =
|
const { filteredNavItems, matchedAgents, matchedTasks, matchedRuns, matchedGoals, matchedProjects, hasEntityResults } =
|
||||||
useMemo(() => ui.buildPaletteResults(
|
useMemo(() => ui.buildPaletteResults(
|
||||||
@@ -120,12 +122,12 @@ export function App() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const appActions = useMemo<AppActions>(() => ({
|
const appActions = useMemo<AppActions>(() => ({
|
||||||
refresh: company.refresh,
|
refresh: refreshCompany,
|
||||||
setError,
|
setError,
|
||||||
openPathWithFeedback: company.openPathWithFeedback,
|
openPathWithFeedback,
|
||||||
startRun,
|
startRun,
|
||||||
cancelRun,
|
cancelRun,
|
||||||
}), [company.refresh, company.openPathWithFeedback, startRun, cancelRun, setError]);
|
}), [refreshCompany, openPathWithFeedback, startRun, cancelRun, setError]);
|
||||||
|
|
||||||
if (!company.snapshot) {
|
if (!company.snapshot) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in new issue
Block a user