Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/funky-rooms-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wtc": patch
---

Fixes an issue where a call to metadata that would error would stop the TUI from continuing.
32 changes: 20 additions & 12 deletions src/tui/pages/teamwork/project-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,32 @@ export function ProjectTab() {
return;
}

if (!projectId) {
setProjectMessage("Set teamwork.projectId in Settings to load Teamwork metadata.");
return;
}

if (authStatus === "missing") {
setProjectMessage(
"Teamwork auth not configured. Use Settings or `wtc config auth set` to add your API token.",
);
return;
}

const metadata = await getTeamworkProjectMetadata(projectId);
setProjectMetadata(metadata);
const messages: string[] = [];

if (projectId) {
try {
const metadata = await getTeamworkProjectMetadata(projectId);
setProjectMetadata(metadata);
messages.push(
metadata.source === "cache"
? "Using cached Teamwork project metadata."
: "Fetched Teamwork project metadata.",
);
} catch (error) {
messages.push(
`Failed to load project metadata: ${error instanceof Error ? error.message : String(error)}`,
);
}
} else {
messages.push("Set teamwork.projectId in Settings to load Teamwork metadata.");
}

const results = await getPinnedTaskListTasks(config.project.teamwork.pinnedTaskLists);
const nextPinnedTaskLists: PinnedTaskListState[] = results.map((r) => ({
Expand All @@ -113,11 +125,7 @@ export function ProjectTab() {

setPinnedTaskLists(nextPinnedTaskLists);
setSelectedTask(getNextPinnedTaskSelection(nextPinnedTaskLists, selectedTask(), 1));
setProjectMessage(
metadata.source === "cache"
? "Using cached Teamwork project metadata."
: "Fetched Teamwork project metadata.",
);
setProjectMessage(messages.join(" "));
} catch (error) {
setProjectMessage(error instanceof Error ? error.message : "Failed to load project context.");
}
Expand Down
Loading