-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Save button not correctly disabled when there's no changes #9000
Comments
Encountered the same bug (at least since v117)
It seems that the relation modal passes down the complete object on save instead of just the id |
This issue has been automatically locked. |
🚀 This is included in version v3.0.0-beta.127 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the Bug
When editing a collection, the "Save" button should be disabled upon no changes to this collection.
However, in my case, I have Block Item Block inside collection Courses and the block has a "type: 'relationship'" to another collection Items, when collection Items is edited directly inside Courses, the "Save" button on the Courses editing page becomes clickable and throws error "This relationship field has the following invalid relationships: [object Object] 0" upon clicking.
This bug was introduced after upgrading from beta.103 to beta.104.
Link to the code that reproduces this issue
https://github.com/shangjieJayZhou/payload3.0-bug-report
Reproduction Steps
run "pnpm i"
copy everything in ".env.local.example" into a file ".env"
Either tweak the DATABASE_URI in .env to fit your local db, or make sure you have a locally running postgres db on 5432 with database "lms" and schema "payload-content"
run "pnpm dev"
(assume your payload is running on 3000) Log in to http://localhost:3000/admin
Go to collection Courses
Click "Create New" and you should be seeing this

Click "Add Content" and add an Item Block, and you should be seeing this

Click the "+" button on the right to add an item inside this newly created Item Block. Give it any name and price, should look something like this

Click "Save" to add this item and close this item window, you should be back to the Course page and see this

Click "Save" on the top right to save changes to this Course, after clicking "Save" there should be no error and you should see that the "Save" button now turns grey:

Go edit the item you just added by clicking on the edit icon on the item inside the Item Block, then change the name(or the price, doesn't matter) to something different and save, after saving you should see something like this:

Close the item window and you should be back to the course editing page, and you should see that the "Save" button is no longer greyed out and is clickable (while it SHOULD NOT be)

Click on "Save" and you should see an error, like this

Which area(s) are affected? (Select all that apply)
area: ui, plugin: nested-docs
Environment Info
Binaries:
Node: 20.13.1
npm: 10.5.2
Yarn: 1.22.22
pnpm: 9.7.0
Relevant Packages:
payload: 3.0.0-beta.123
next: 15.0.0
@payloadcms/db-mongodb: 3.0.0-beta.123
@payloadcms/db-postgres: 3.0.0-beta.123
@payloadcms/graphql: 3.0.0-beta.123
@payloadcms/next/utilities: 3.0.0-beta.123
@payloadcms/richtext-lexical: 3.0.0-beta.123
@payloadcms/richtext-slate: 3.0.0-beta.123
@payloadcms/translations: 3.0.0-beta.123
@payloadcms/ui/shared: 3.0.0-beta.123
react: 19.0.0-rc-65a56d0e-20241020
react-dom: 19.0.0-rc-65a56d0e-20241020
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.5.0: Wed May 1 20:19:05 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8112
Available memory (MB): 16384
Available CPU cores: 8
The text was updated successfully, but these errors were encountered: