feat: filter to ephemeral streams and particles
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
toFirestoreChildrenPath,
|
||||
} from "@/lib/particle-path";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { QueryFieldFilterConstraint } from "firebase/firestore";
|
||||
|
||||
interface UseLiveParticleResult {
|
||||
particle: Particle | null;
|
||||
@@ -62,6 +63,7 @@ export function useLiveParticleChildren(
|
||||
visibilityScopes?: string[],
|
||||
onAdded?: (child: Particle) => void,
|
||||
onRemoved?: (child: Particle, updatedChildren: Particle[]) => void,
|
||||
whereFilter?: QueryFieldFilterConstraint
|
||||
): UseLiveParticleChildrenResult {
|
||||
const [children, setChildren] = useState<Particle[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
@@ -89,9 +91,11 @@ export function useLiveParticleChildren(
|
||||
orderDirection,
|
||||
onAdded,
|
||||
onRemoved,
|
||||
whereFilter,
|
||||
);
|
||||
|
||||
return unsubscribe;
|
||||
// FIX: do we need to listen to more deps? Would that cause side effects that break behavior
|
||||
}, [collectionPath]);
|
||||
|
||||
return { children, isLoading, error };
|
||||
|
||||
Reference in New Issue
Block a user