fix: pause playback during delete particle overlay
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
import { useCallback, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { ConfirmDestructiveOverlay } from "@/components/confirm-destructive-overlay";
|
import { ConfirmDestructiveOverlay } from "@/components/confirm-destructive-overlay";
|
||||||
import { softDeleteParticle } from "@/lib/firestore-particles";
|
import { softDeleteParticle } from "@/lib/firestore-particles";
|
||||||
import { particlePath, toFirestoreDocPath } from "@/lib/particle-path";
|
import { particlePath, toFirestoreDocPath } from "@/lib/particle-path";
|
||||||
import type { Particle } from "@/api/types";
|
import type { Particle } from "@/api/types";
|
||||||
|
import { usePlaybackSuspenderStore } from "@/stores/playback-suspender-store";
|
||||||
|
|
||||||
interface DeleteParticleOverlayProps {
|
interface DeleteParticleOverlayProps {
|
||||||
networkId: string;
|
networkId: string;
|
||||||
@@ -20,6 +21,13 @@ export function DeleteParticleOverlay({
|
|||||||
userId,
|
userId,
|
||||||
onClose,
|
onClose,
|
||||||
}: DeleteParticleOverlayProps) {
|
}: DeleteParticleOverlayProps) {
|
||||||
|
// Suspend stream playback
|
||||||
|
useEffect(() => {
|
||||||
|
const { suspend, release } = usePlaybackSuspenderStore.getState();
|
||||||
|
suspend();
|
||||||
|
return release;
|
||||||
|
}, []);
|
||||||
|
|
||||||
const [deleting, setDeleting] = useState(false);
|
const [deleting, setDeleting] = useState(false);
|
||||||
|
|
||||||
const handleDelete = useCallback(async () => {
|
const handleDelete = useCallback(async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user