feat: use declarative callbacks for data changes
This commit is contained in:
@@ -60,6 +60,8 @@ export function useLiveParticleChildren(
|
||||
orderByField: string = "created_at",
|
||||
orderDirection: "asc" | "desc" = "desc",
|
||||
visibilityScopes?: string[],
|
||||
onAdded?: (child: Particle) => void,
|
||||
onRemoved?: (child: Particle, updatedChildren: Particle[]) => void,
|
||||
): UseLiveParticleChildrenResult {
|
||||
const [children, setChildren] = useState<Particle[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
@@ -85,6 +87,8 @@ export function useLiveParticleChildren(
|
||||
visibilityScopes,
|
||||
orderByField,
|
||||
orderDirection,
|
||||
onAdded,
|
||||
onRemoved,
|
||||
);
|
||||
|
||||
return unsubscribe;
|
||||
|
||||
Reference in New Issue
Block a user