Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autosave closed early and infinite loading of the component #11145

Open
NeilRiver opened this issue Feb 12, 2025 · 7 comments
Open

Autosave closed early and infinite loading of the component #11145

NeilRiver opened this issue Feb 12, 2025 · 7 comments
Labels
status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@NeilRiver
Copy link

Describe the Bug

Hi! I was experimenting with blocks and immediately got an error

Image

Link to the code that reproduces this issue

https://github.com/NeilRiver/payload_issues

Reproduction Steps

  1. I went to your git and copied the ExampleTabs block from there
  2. Inserted it into myself
  3. I registered my new block in RenderBlock
import React, { Fragment } from 'react'

import type { Page } from '@/payload-types'

import { ArchiveBlock } from '@/blocks/ArchiveBlock/Component'
import { CallToActionBlock } from '@/blocks/CallToAction/Component'
import { ContentBlock } from '@/blocks/Content/Component'
import { FormBlock } from '@/blocks/Form/Component'
import { MediaBlock } from '@/blocks/MediaBlock/Component'
import { ExampleTabs } from './ExampleTabs'   <---------------

const blockComponents = {
  archive: ArchiveBlock,
  content: ContentBlock,
  cta: CallToActionBlock,
  formBlock: FormBlock,
  mediaBlock: MediaBlock,
  exampleTabs: ExampleTabs,   <---------------
}
  1. Go to http://localhost:3000/admin/collections/pages/2
  2. Press "Add Layout"
  3. Press "Example Tabs"
  4. I decided to name the block "qwe" and got an error

Image


EXTRA:
and there is also an eternal loading of the component. You add it and it is like loading and will never load
(in order for it to load you need to press f5)
Image

Which area(s) are affected? (Select all that apply)

area: core, area: templates, area: ui

Environment Info

Binaries:
  Node: 22.11.0
  npm: N/A
  Yarn: N/A
  pnpm: 9.15.5
Relevant Packages:
  payload: 3.23.0
  next: 15.1.7
  @payloadcms/email-nodemailer: 3.23.0
  @payloadcms/graphql: 3.23.0
  @payloadcms/live-preview: 3.23.0
  @payloadcms/live-preview-react: 3.23.0
  @payloadcms/next/utilities: 3.23.0
  @payloadcms/payload-cloud: 3.23.0
  @payloadcms/plugin-form-builder: 3.23.0
  @payloadcms/plugin-nested-docs: 3.23.0
  @payloadcms/plugin-redirects: 3.23.0
  @payloadcms/plugin-search: 3.23.0
  @payloadcms/plugin-seo: 3.23.0
  @payloadcms/richtext-lexical: 3.23.0
  @payloadcms/translations: 3.23.0
  @payloadcms/ui/shared: 3.23.0
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 16316
  Available CPU cores: 6
@NeilRiver NeilRiver added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction labels Feb 12, 2025
@NeilRiver
Copy link
Author

Update 2: I figured out that you need to put a UI component in RenderBlocks, not a scheme. Okay. I deleted my block from there. But the miracle didn't happen. It still renders in 1 step / f5, and is not displayed on the screen.

@danielkoller
Copy link

I have the same error message all the time, although the block components are loading normally.

@notflip
Copy link

notflip commented Feb 16, 2025

I've been getting this error as well, even on 3.18. I tried increasing the interval time of my autosave, but that's not helping.

@ForrestDevs
Copy link

I too am getting this same issue, "autosave closed early" it seems to happen when i have alot of blocks or a media field that takes a bit longer to load and then this error occurs.

@rob-at-airwalk
Copy link

I also get this error. When it happens, some fields in custom blocks also disappear until the page is refreshed.

@alexmacdonell
Copy link

Same issue for me -- seems to be a regular occurance, and happens across a variety of blocks, not a single-specific block.

Payload v3.23.0

@ForrestDevs
Copy link

ForrestDevs commented Feb 19, 2025

I have this

versions: {
    drafts: {
      validate: true, // Adding this helped with the autosave error 
      autosave: {
        interval: 10000, // Tried various values out here, don't think this has any effect on this bug (could be small or large value)
      },
    },
    maxPerDoc: 50,
  }

which seems to have subsided the autosave error for now. I think the validate: true is the main aspect solving it, as i believe whats happening is theres some sort of race condition happening with an unvalidated doc state attempting to be saved before the doc is validated which causes it to get stuck.

I've only ever noticed this error come up ONLY after making a change, never before.

Try the validate: true property and see if that changes anything, still a bandaid fix until the payload team can investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
Development

No branches or pull requests

6 participants