Skip to content
Closed
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
4 changes: 4 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@
## 2026-06-10 - Optimize redundant dictionary lookups in tight loops
**Learning:** Using `dict.setdefault` and multiple `dict.get` or `key in dict` checks inside tight loops significantly impacts performance due to repeated dictionary lookups and unnecessary list allocations. Caching dictionary lookups (e.g., using a single `dict.get(key)`) and conditionally handling the logic based on the result is much more performant.
**Action:** When aggregating or grouping items in a loop, avoid `setdefault`. Instead, check if the key exists using a single `.get()`, and perform initialization/updates conditionally. Additionally, hoist loop-invariant checks (e.g., `folder == "sent"`) outside the loop to avoid redundant evaluations.

## 2025-02-12 - Handle UI Rendering with Optional Number Values
**Learning:** When displaying numerical data in React where `0` is a valid number, using truthiness checks like `{value && (<div>{value}%</div>)}` will skip rendering when `value === 0` because `0` is falsy in JavaScript.
**Action:** When handling optional numerical data (e.g., confidence scores, indices, percentages), always explicitly check for `!== undefined` or `!== null` (e.g., `{confidence !== undefined && (...)}`) instead of relying on generic truthiness to ensure valid `0` values render properly and safely.
5 changes: 3 additions & 2 deletions frontend/src/components/EmailDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type EmailData = ThreadEmailData & {
interface LlmData {
summary: string;
todos: string[];
confidence?: number;
}

interface CreateTasksFromEmailResponse {
Expand Down Expand Up @@ -356,7 +357,7 @@ export function EmailDetail({ emailId, actionCommand = null }: { emailId: number
loading={!llmData && !llmError}
error={llmError}
provenance="AI 생성"
// TODO: API 연동 시 실제 llmData.confidence 값으로 대체
confidence={llmData?.confidence !== undefined ? Math.round(llmData.confidence * 100) : undefined}
>
{llmData ? (
<div className="flex flex-col gap-2">
Expand All @@ -378,7 +379,7 @@ export function EmailDetail({ emailId, actionCommand = null }: { emailId: number
empty={Boolean(llmData && llmData.todos.length === 0)}
emptyMessage="실행 항목이 없습니다."
provenance={`${llmData?.todos.length || 0}개 실행 항목`}
// TODO: API 연동 시 실제 llmData.confidence 값으로 대체
confidence={llmData?.confidence !== undefined ? Math.round(llmData.confidence * 100) : undefined}
footerActions={llmData && (llmData.todos.length > 0 || syncStatus || taskStatus) ? (
<>
{llmData.todos.length > 0 && (
Expand Down
Loading