Open
Description
Describe the Bug
After upgrading from Payload CMS v3.42 to v3.43, I encountered an unhandled exception when trying to view a version of a document that contains a relationship field pointing to a deleted document. (Related to #12027)
Instead of gracefully handling the missing relation (e.g., displaying "Untitled" like the main document view does), the version view crashes with the following error:
TypeError: Cannot use 'in' operator to search for 'relationTo' in 685a93b1c6c9ce7a381d301a
2025-06-24.14-01-44.mp4
Thanks! (BTW, the new version view is great!) 🖤
Link to the code that reproduces this issue
https://github.com/jhb-dev/payload-343-version-view-bug-reproduction
Reproduction Steps
- Create a document with a relationship field.
- Save a version of the document.
- Add a document to the relationship field.
- Delete the related document that was selected in the relationship field.
- Try to open the version view of the original document.
- Observe the unhandled exception.
Which area(s) are affected? (Select all that apply)
area: ui
Environment Info
Binaries:
Node: 20.19.0
npm: N/A
Yarn: N/A
pnpm: 10.5.2
Relevant Packages:
payload: 3.43.0
next: 15.3.0
@payloadcms/db-mongodb: 3.43.0
@payloadcms/email-nodemailer: 3.43.0
@payloadcms/graphql: 3.43.0
@payloadcms/next/utilities: 3.43.0
@payloadcms/payload-cloud: 3.43.0
@payloadcms/richtext-lexical: 3.43.0
@payloadcms/translations: 3.43.0
@payloadcms/ui/shared: 3.43.0
react: 19.1.0
react-dom: 19.1.0
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Home
Available memory (MB): 32694
Available CPU cores: 24