Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(timeline): guard frame.devices access against undefined (#4393)

Louis Beaumonta0b6e2fc05c5
diff --git a/apps/screenpipe-app-tauri/components/rewind/timeline/app-context-popover.tsx b/apps/screenpipe-app-tauri/components/rewind/timeline/app-context-popover.tsx
index c31c8d644..127e31bc9 100644
--- a/apps/screenpipe-app-tauri/components/rewind/timeline/app-context-popover.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/timeline/app-context-popover.tsx
@@ -118,7 +118,7 @@ export function AppContextPopover({
const transcripts: { text: string; time: Date; speaker?: string }[] = [];
const seenChunks = new Set<number>();
for (const frame of frames) {
- for (const device of frame.devices) {
+ for (const device of frame.devices ?? []) {
for (const audio of device.audio || []) {
if (!audio.transcription?.trim()) continue;
if (seenChunks.has(audio.audio_chunk_id)) continue;
diff --git a/apps/screenpipe-app-tauri/components/rewind/timeline/timeline.tsx b/apps/screenpipe-app-tauri/components/rewind/timeline/timeline.tsx
index da225aa19..038647093 100644
--- a/apps/screenpipe-app-tauri/components/rewind/timeline/timeline.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/timeline/timeline.tsx
@@ -1747,13 +1747,13 @@ export const TimelineSlider = ({
const hasAudio = frame?.devices?.some((d) => d.audio?.some((a) => a.transcription?.trim()));
const isCurrent = frameIndex === currentIndex;
- const matchesDevice = selectedDeviceId === "all" || frame.devices.some((d) => d.device_id === selectedDeviceId);
- const matchesApp = selectedAppName === "all" || frame.devices.some((d) => d.metadata?.app_name === selectedAppName);
- const matchesDomain = selectedDomain === "all" || frame.devices.some((d) => {
+ const matchesDevice = selectedDeviceId === "all" || (frame.devices?.some((d) => d.device_id === selectedDeviceId) ?? false);
+ const matchesApp = selectedAppName === "all" || (frame.devices?.some((d) => d.metadata?.app_name === selectedAppName) ?? false);
+ const matchesDomain = selectedDomain === "all" || (frame.devices?.some((d) => {
const url = d.metadata?.browser_url?.trim();
return url ? extractDomain(url) === selectedDomain : false;
- });
- const matchesSpeaker = selectedSpeaker === "all" || frame.devices.some((d) => d.audio?.some((a) => a.speaker_name === selectedSpeaker));
+ }) ?? false);
+ const matchesSpeaker = selectedSpeaker === "all" || (frame.devices?.some((d) => d.audio?.some((a) => a.speaker_name === selectedSpeaker)) ?? false);
const frameIdForTag = frame.devices?.[0]?.frame_id || '';
const frameTagsForFilter = frameIdForTag ? (tags[frameIdForTag] || []) : [];
const matchesTag = selectedTag === "all" || frameTagsForFilter.includes(selectedTag);