Improve real-time sync speed and caching
- Reduced polling interval from 3s to 2s for faster updates - Added revalidate = 0 to prevent Next.js caching - Updates from other browsers now appear within 2 seconds - Both home page and list detail pages sync faster
This commit is contained in:
@@ -9,6 +9,7 @@ import InlineItemCreate from '@/components/InlineItemCreate'
|
|||||||
import ListDetailView from '@/components/ListDetailView'
|
import ListDetailView from '@/components/ListDetailView'
|
||||||
|
|
||||||
export const dynamic = 'force-dynamic'
|
export const dynamic = 'force-dynamic'
|
||||||
|
export const revalidate = 0
|
||||||
|
|
||||||
export default async function ListDetailPage({ params }: { params: { id: string } }) {
|
export default async function ListDetailPage({ params }: { params: { id: string } }) {
|
||||||
const session = await getServerSession(authOptions)
|
const session = await getServerSession(authOptions)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { authOptions } from '@/pages/api/auth/[...nextauth]'
|
|||||||
import { redirect } from 'next/navigation'
|
import { redirect } from 'next/navigation'
|
||||||
|
|
||||||
export const dynamic = 'force-dynamic'
|
export const dynamic = 'force-dynamic'
|
||||||
|
export const revalidate = 0
|
||||||
|
|
||||||
export default async function Home() {
|
export default async function Home() {
|
||||||
const session = await getServerSession(authOptions)
|
const session = await getServerSession(authOptions)
|
||||||
@@ -22,7 +23,7 @@ export default async function Home() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="container mx-auto px-4 sm:px-6 py-6 sm:py-8 max-w-7xl">
|
<main className="container mx-auto px-4 sm:px-6 py-6 sm:py-8 max-w-7xl">
|
||||||
<RealtimeUpdater pollInterval={3000} />
|
<RealtimeUpdater pollInterval={2000} />
|
||||||
<div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mb-6 sm:mb-8">
|
<div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mb-6 sm:mb-8">
|
||||||
<h1 className="text-2xl sm:text-3xl lg:text-4xl font-bold text-gray-900">Ultimate Lists</h1>
|
<h1 className="text-2xl sm:text-3xl lg:text-4xl font-bold text-gray-900">Ultimate Lists</h1>
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export default function ListDetailView({
|
|||||||
useRealtimeSync({
|
useRealtimeSync({
|
||||||
listId,
|
listId,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
pollInterval: 3000, // Poll every 3 seconds
|
pollInterval: 2000, // Poll every 2 seconds
|
||||||
})
|
})
|
||||||
|
|
||||||
// Extract all unique tags from items
|
// Extract all unique tags from items
|
||||||
|
|||||||
Reference in New Issue
Block a user