From 2e2949be27d0a653653ed7e1eb4daeb692a2109f Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Thu, 9 Oct 2025 13:38:38 +0000 Subject: [PATCH 1/2] Update scheduled posts calendar to automatically display new posts Invalidates the '/api/scheduled-posts' query cache on successful post creation to trigger a refetch and update the UI, resolving the need for manual page reloads. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/Z1TMYri --- .replit | 4 ---- client/src/pages/new-post.tsx | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.replit b/.replit index ad7eeab..7bce39b 100644 --- a/.replit +++ b/.replit @@ -34,10 +34,6 @@ externalPort = 5000 localPort = 37659 externalPort = 4200 -[[ports]] -localPort = 39387 -externalPort = 8008 - [[ports]] localPort = 40537 externalPort = 3000 diff --git a/client/src/pages/new-post.tsx b/client/src/pages/new-post.tsx index 03de55e..b8dd866 100644 --- a/client/src/pages/new-post.tsx +++ b/client/src/pages/new-post.tsx @@ -213,7 +213,8 @@ export default function NewPost() { const createPostMutation = useMutation({ mutationFn: (data: any) => apiRequest('POST', '/api/posts', data), - onSuccess: () => { + onSuccess: async () => { + await queryClient.invalidateQueries({ queryKey: ['/api/scheduled-posts'], refetchType: 'all' }); toast({ title: "Publication créée", description: "La publication a été créée avec succès", From 27b4f32e62a25de5571c686ec3610f5c384d30ca Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Thu, 9 Oct 2025 14:18:04 +0000 Subject: [PATCH 2/2] Fix dashboard count for scheduled posts and improve AI text display Correctly set the status of scheduled posts to "scheduled" instead of "draft" and update the dashboard count. Also, reposition AI text variations for a better user workflow. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/vX672i1 --- replit.md | 7 +++++++ server/routes.ts | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/replit.md b/replit.md index ad54cda..5e34f5d 100644 --- a/replit.md +++ b/replit.md @@ -8,6 +8,13 @@ Social Flow is a comprehensive social media automation platform designed to stre Preferred communication style: Simple, everyday language. +## Recent Changes + +### October 9, 2025 +- **AI Variants Position**: Repositioned AI-generated text variations to display after "Contenu" card and before "Texte de la publication" card in new-post page for better workflow +- **Calendar Auto-Refresh**: Fixed calendar not updating after creating a new scheduled post. Added `queryClient.invalidateQueries` with `refetchType: 'all'` in `createPostMutation.onSuccess` to force cache invalidation and immediate refetch +- **Dashboard Scheduled Posts Count**: Fixed scheduled posts count showing 0 in dashboard. Problem was that posts with `scheduledFor` were created with status "draft" instead of "scheduled". Solution: POST /api/posts now sets `status = "scheduled"` when `scheduledFor` is provided. Legacy posts updated with SQL: `UPDATE posts SET status = 'scheduled' WHERE scheduled_for IS NOT NULL AND status = 'draft'` + ## System Architecture ### Frontend Architecture diff --git a/server/routes.ts b/server/routes.ts index 6e418ce..a176d7a 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -597,6 +597,11 @@ export async function registerRoutes(app: Express): Promise { postFields.scheduledFor = new Date(postFields.scheduledFor); } + // Set status to "scheduled" if scheduledFor is provided, otherwise "draft" + if (postFields.scheduledFor) { + postFields.status = "scheduled"; + } + // Create the post const postData = insertPostSchema.parse({ ...postFields, userId }); const post = await storage.createPost(postData);