Open HarleySalas opened 6 months ago
Here are two recordings to try and illustrate the issue. Take note of how after certain actions, the option to select something which should be selectable disappears. There's a few funky things going on there, but I think the picture can provide more clarity than words.
https://github.com/payloadcms/payload-3.0-demo/assets/38236585/fac6a32f-1ad5-4924-8812-c563f63f6b40
https://github.com/payloadcms/payload-3.0-demo/assets/38236585/b94af0c8-f32b-437a-acdd-c8e26be54541
In the following reproduction, I have a collection of
Movie
,Theatre
andUpload
.An
Upload
belongs to aTheatre
. AMovie
is owned by aTheatre
.An
Upload
should only be assignable to aMovie
, where theMovie
'smovie.theatre
id is equal to theupload.theatre
id.As it stands, the following code works out for this logic:
However, If you have
TheatreA
selected, and selectUploadA
, then changevideo.theatre
toTheatreB
,UploadA
is not removed. The user experience is seemingly impossible to make reasonable, with making entirely custom field components. You can play around with it and see numerous scenarios where thefilterOptions
is not fixed until refreshing the page, as well. For example, it's possible to have bothUploadA
andUploadB
selectable in the select component, which should certainly never happen.I believe that in this scenario, it should not only ensure that the
filterOptions
are always correct, but it should remove a selected item, if it's not present in thefilterOptions
.If you'd like to clone the reproduction, to easily play around with this, you can follow these instructions:
git clone -b filter-options-wont-update https://github.com/HarleySalas/payload-3-reproductions.git
pnpm install
.env.example
to.env
docker-compose up
pnpm dev
Movie
There is no need to modify anything inside of
.env
. All necessary data will be seeded.