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 @@ -61,3 +61,7 @@
## 2026-07-13 - Array.from mapping optimization
**Learning:** Using `Array.from({ length: N }).map(...)` creates an intermediate array of `undefined` values which requires memory allocation and garbage collection, adding O(N) unnecessary overhead in frequently re-rendered UI components.
**Action:** Use `Array.from({ length: N }, (_, index) => ...)` to map elements directly during array creation, avoiding intermediate allocations.

## 2025-05-19 - O(1) Lookups for List Deduplication
**Learning:** Checking membership against a list in a loop (`if value not in lst: lst.append(value)`) creates an O(N^2) complexity path, which degrades performance for large inputs.
**Action:** When tracking seen elements for a sequential list, maintain a supplementary `set` alongside the list (e.g., `seen.add(value)`) to ensure O(1) membership checks and O(N) overall complexity.
2 changes: 1 addition & 1 deletion apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"lucide-react": "^1.24.0",
"pdfjs-dist": "6.1.200",
"pdfjs-dist": "^6.2.108",
"react": "^19.2.4",
"react-dom": "^19.2.7",
"sonner": "^2.0.7",
Expand Down
49 changes: 13 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,8 @@
"overrides": {
"brace-expansion": "5.0.9",
"postcss": "8.5.25"
},
"dependencies": {
"pdfjs-dist": "^6.2.108"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,26 @@ def _role_display_name(role: Mapping[str, object]) -> str | None:
def _active_role_names(section: Mapping[str, object]) -> list[str]:
"""Return de-duplicated display names for the section's active roles."""
names: list[str] = []
seen: set[str] = set()
for role in _active_roles(section):
name = _role_display_name(role)
if name is not None and name not in names:
if name is not None and name not in seen:
seen.add(name)
names.append(name)
return names


def _section_cue(section: Mapping[str, object]) -> str:
"""Join the active roles' cue values into a single cue string."""
cues: list[str] = []
seen: set[str] = set()
for role in _active_roles(section):
cue = role.get("cue")
if not isinstance(cue, Mapping):
continue
value = cue.get("value")
if isinstance(value, str) and value and value not in cues:
if isinstance(value, str) and value and value not in seen:
seen.add(value)
cues.append(value)
return "; ".join(cues)

Expand Down
Loading