#Live preview not updating randomly

6 messages · Page 1 of 1 (latest)

limber rapids
#
// collection email
import { WEB_URL } from '@/app/(app)/src/constants'
import { BlocksFeature, lexicalEditor } from '@payloadcms/richtext-lexical'
import type { CollectionConfig } from 'payload'

// import { Border, CustomDiv, MediaBlock, Spacer } from '@/blocks'

export const Email: CollectionConfig = {
  slug: 'Emails',
  admin: {
    useAsTitle: 'title',
    livePreview: {
      url: ({ data }) => {
        return `${WEB_URL}/preview/email/${data.id}`
      },
    },
    group: 'Emails',
    enableRichTextLink: true,
    enableRichTextRelationship: false,
  },
  versions: {
    drafts: {
      autosave: {
        interval: 200,
      },
      
    },
  },
  fields: [
    {
      name: 'title',
      type: 'text',
      label: 'Title',
      required: true,
      admin: {
        position: 'sidebar',
        description: `The title of the email`,
      },
    },
    {
      name: 'previewText',
      type: 'text',
      label: 'Preview Text',
      required: true,
      admin: {
        position: 'sidebar',
        description: 'The preview text of the email',
      },
    },
    {
      name: 'footerContent',
      type: 'text',
      label: 'Footer Content',
      required: true,
      admin: {
        position: 'sidebar',
        description: 'The footer content of the email',
      },
    },
    {
      name: 'content',
      type: 'richText',
      label: 'Content',
      required: true,
      editor: lexicalEditor({
        features: ({ defaultFeatures }) => [
          ...defaultFeatures,
          //   BlocksFeature({
          //     blocks: [MediaBlock, CustomDiv, Spacer, Border],
          //   }),
        ],
      }),
    },
  ],
}
limber rapids
#

Everytime I restart my instance, the preview page updates..? Is it a cache issue?

#

It randomly started working again... Is it to do with a database?

limber rapids
#

Okay, seems to be working fine now, live preview doesnt seem to work well with bad wifi, doesnt update properly