feat: placements update
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
// Projects Page (Target Channels) - Enhanced with Statistics
|
||||
// ============================================================================
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useParams } from "next/navigation";
|
||||
import Link from "next/link";
|
||||
import {
|
||||
@@ -166,6 +166,26 @@ export default function ProjectsPage() {
|
||||
|
||||
const { isDemoMode } = useWorkspace();
|
||||
|
||||
// Poll projects list every 5s so newly added projects (via bot) appear automatically.
|
||||
const refreshProjectsRef = useRef(refreshProjects);
|
||||
useEffect(() => {
|
||||
refreshProjectsRef.current = refreshProjects;
|
||||
}, [refreshProjects]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!workspaceId) return;
|
||||
if (isDemoMode) return;
|
||||
|
||||
const intervalId = window.setInterval(() => {
|
||||
if (typeof document !== "undefined" && document.hidden) return;
|
||||
void refreshProjectsRef.current();
|
||||
}, 5000);
|
||||
|
||||
return () => {
|
||||
window.clearInterval(intervalId);
|
||||
};
|
||||
}, [workspaceId, isDemoMode]);
|
||||
|
||||
const handleOpenSettings = (project: Project) => {
|
||||
setSettingsProject(project);
|
||||
setInviteLinkType(project.purchase_invite_type_default || "public");
|
||||
|
||||
Reference in New Issue
Block a user