-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix: orderable collection not working when collection has group or tab field #12129
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
base: main
Are you sure you want to change the base?
Conversation
This PR should fix this issue #12143 |
Thanks for the contribution. This PR does indeed fix the bug described with the group or tab field, which I've been able to reproduce, but it's not related to issue #12143, which is due to an incorrect migration, as I explained here. For now, e2e tests only run on MongoDB, which is why the bug wasn't properly detected. If you do an integration test, it will run with Postgres in CI. A nice thing to have, although not strictly necessary in this case, as I reproduced the issue and the solution manually. The only impediment to merging this is that there's a small TypeScript error blocking the build. Can you take a look at it? |
Hey @GermanJablo! I fixed the TS issue and found out that my change break the draft ordering. I implemented a fix in 7592724 but I'd love to hear your opinion. Tbh, I'm not a fan of hardcoded value. Also, seems like CI job with builds are failing due to this error
Can you help me with the issue since I don't think this issue is caused with this PR. |
You know what? I just tried to reproduce the bug again and couldn't. Reproduction steps:
I think I saw an error the first time I tried that. But now I'm wondering, maybe I was confused by another configuration. The first step to moving forward with a solution is to be able to reproduce the problem. So if you could walk me through the steps, that would be great. I have a few observations about the current attempted fix, but first, I want to make sure there really is a bug here. P.S: Yes, ignore the current error in CI. It's not related to this PR. We're investigating it. |
Hey @GermanJablo can you take another look, seems like @joedawson made the repo where issue does occur |
Hi @kristian240, that issue mentions:
I've opened the repo, and I don't see collections having groups or tabs, so I don't think this PR describes a reproducible issue yet. |
Would the SEO fields be considered a group in my issue? |
Yes the SEO plugin creates a |
Yes, I just checked. It's very likely the same issue then. I'm still debugging. |
What?
There is an issue when Payload uses
postgresAdapter
. If collection is orderable and there is a field that is type ofgroup
ortab
.I cannot replicate the issue in e2e tests and mongoDB but if I use Postgres the issue is there; can you shed some light why is that? Also, how can I run e2e with Postgres db?
Why?
After the group and tab fields are transformed, there is a piece of code that deletes
_order
prop on the root of the document, instead, we should delete_order
in that field.How?
Now, we delete
_order
inref[refKey]
instead on the root document -ref
.