feat: filter to ephemeral streams and particles
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import { useCallback, useEffect, useEffectEvent, useMemo, useReducer, useRef } from "react";
|
||||
import { useCallback, useEffect, useEffectEvent, useMemo, useReducer, useRef, useState } from "react";
|
||||
import { useAuthStore } from "@/stores/auth-store";
|
||||
import type { Particle } from "@/api/types";
|
||||
import { useLiveParticleChildren } from "@/hooks/use-particle";
|
||||
import { toFirestoreDocPath, type ParticlePath } from "@/lib/particle-path";
|
||||
import { updateStreamPlaybackMarker } from "@/lib/firestore-particles";
|
||||
import { where, Timestamp } from "firebase/firestore";
|
||||
import { RECENCY_WINDOW_HOURS } from "@/lib/constants";
|
||||
|
||||
// --- Playback reducer (ID-based) ---
|
||||
|
||||
@@ -112,8 +114,15 @@ export function useStreamPlayback(
|
||||
});
|
||||
});
|
||||
|
||||
const [recencyCutoff] = useState(() => {
|
||||
const d = new Date();
|
||||
d.setHours(d.getHours() - RECENCY_WINDOW_HOURS);
|
||||
return Timestamp.fromDate(d);
|
||||
});
|
||||
|
||||
const { children } = useLiveParticleChildren(
|
||||
path, "created_at", "asc", undefined, onParticleAdded, onParticleRemoved,
|
||||
where("created_at", ">=", recencyCutoff),
|
||||
);
|
||||
|
||||
// Derive current index and particle from ID
|
||||
|
||||
Reference in New Issue
Block a user