payload
payload copied to clipboard
Autosave makes it impossible to create new (localized) documents
Link to reproduction
No response
Environment Info
Binaries:
Node: 20.12.2
npm: 10.5.0
Yarn: N/A
pnpm: 9.10.0
Relevant Packages:
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:04 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6020
Available memory (MB): 16384
Available CPU cores: 12
Describe the Bug
When creating a new document with autosave enabled, it creates a new document instantly, but not the relative localized fields records.
This causes an instantaneous redirect to the /doc/{id} page that shows a not found message.
I can see in the database a new record in the main document table, but not in the relative _locales table.
This a new bug that I personally encountered recently, either after upgrading to one of the latest beta or when I changed the idType to uuid.
Reproduction Steps
- enable autosave in the collection config:
...
versions: {
drafts: {
autosave: {
interval: 100,
},
},
}
...
- Enable localization in the payload config
...
localization: {
defaultLocale: "en",
locales: [{ code: "en", label: "English" }, { code: "it", label: "Italian" }],
},
...
- Add
localized: trueto some collection fields - Try to create a new document
Adapters and Plugins
No response
Hey @mattiaz9 I did the same steps I cannot reproduce, using postgres with uuid as well. Can you share your collection config / confirm that it works on a minimal config?
Hi @r1tsuu. It's funny, this morning I tried again and it didn't show the 404.
I noticed that the document is still created automatically. I can see 2 versions created immediately:
If I open the first version it gives me this error: TypeError: Cannot convert undefined or null to object
In the second version a can see it changes some fields from null to empty value:
I'm not sure why yesterday it showed me a 404 and today it doesn't, but still, creating the document during autosave, I believe could create some problems like this. It's probably best to disable creation when it is requested from an autosave.
I'm seeing this same issue on beta.123, but unrelated to localization. I was previously running on beta.117 without issue but I've refactored a lot while upgrading to the latest beta.
In my case, it seems like just having autosave turned on will result in an immediate redirection from /admin/collections/
My configuration is complex in other ways, still working to narrow down what's causing it. For now, disabling autosave entirely seems to prevent the issue.
This issue has been marked as stale due to lack of activity.
To keep this issue open, please indicate that it is still relevant in a comment below.
This issue was automatically closed due to lack of activity.
I am unable to reproduce this error. If you can repro this on the latest version (3.47.0 as of writing this comment) please add more steps to reproduce — a screen recording would also be super helpful.
This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.