Open TrevorSqE opened 4 years ago
Issue-Label Bot is automatically applying the label Type: Bug
to this issue, with a confidence of 0.85. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
Hi,
the Reason it works in the backend is wp_podsrel https://pods.io/docs/database-reference/database-storage-relationship-fields/ Did you use the default edit screen to change the relationship or are you using any other way?
Are you using pods to output the data in the frontend? Does it happen to any other pod relationship you have setup?
Thanks Quasel!
PS Just had the same issue reported by a different client, different site, different CPTs. In their case they were unable to remove tagged items (of post type A) from an item of post type B; but on testing, if I went to edit an item of post type A, tagged item B there and then removed it again, that managed to flush it out - but obviously a bit of a clunky method.
that's weird- @JoryHogeveen did you see anything in that direction?
@quasel I already spoke with @TrevorSqE on Slack. This might be an Admin Columns inline edit related issue. He will do some tests on a sandbox and report back to me!
Okay as I run into this issue again I can confirm that's a bug with bi-directional relationships!
Relationship information ist stored in multiple places (details see below) If you remove an item on one side it should be removing itself from both sides but removal only works properly for the podsrel table. Seems Admin Columns uses the Information from the meta storage for the table view, inline editing works but leads to same issue with meta storage.
meta storage information for the related item is not updated if you
@sc0ttkclark so if it's not, it should be considered a bug and we should get a codeception test showing how that is failing and work to fix the test.
some background how bidirectional stuff is stored (partly due to backward compatibility)
Place to take a look as mentioned by @sc0ttkclark for a different issues in slack https://github.com/pods-framework/pods/blob/main/classes/PodsAPI.php#L4210 deleting relationship data: https://github.com/pods-framework/pods/blob/main/classes/PodsAPI.php#L5862 saving relationship data: https://github.com/pods-framework/pods/blob/main/classes/PodsAPI.php#L4438
We should retest this to see if it's still happening in 2.8, I fixed some code here before 2.8 release which mailed dealt with user objects on a multi site but could have had something to do with the issue reported here too.
Just tested this one with 2.8.4.1, and it's still an issue. I have two CPTs "person" and "service" with a bi-directional relationship field on each, multi-select. If I'm editing Service A, I can add Person X and Person Y, but not then delete Person Y; I have to go and edit Person Y (where Service A is not selected) and then save, at which point they are removed from the field on Service A.
Hi @TrevorSqE I cannot seem to reproduce this behavior on my local installation running 2.8.4.1. What multiselect UI did you choose? List view?
Issue Overview
Relationships are getting 'stuck' - data seems to be deleted in one direction but not the other. It's possible that an incomplete data import was at fault in the first place (?), but we can't fix things manually.
Expected Behavior
Untagging people when editing the sector's relationship field should flush them both ways from the database.
Current Behavior
We have a site with a bi-directional relationship field connecting CPTs 'person' and 'sector'. On a front-end display page for a sector (ID 1234, say), I can see 4 tagged people, but only 2 in the relationship field if I edit the page. If I untag one of those people and save, I now see only 1 in the back-end, but still see 4 on the front.
If I look in the database, wp_postmeta), I see one record with post_id 1234 and meta_key 'related_persons'. But I see four records with meta_value 1234 and meta_key 'related_sectors'.
If I go to edit the people instead of the sectors, I don't see the sector tagged, so can't try deleting it there.
Steps to Reproduce (for bugs)
I can share a login if helpful.
Possible Solution
Make sure that untagging deletes relationship field data from both ends, not just one?
WordPress Environment
Pods Package Export (helpful!)
Workaround or Alternate Solution Until Bug is Addressed
Related Issues and/or PRs
We've seen this before and, I think, reported it but I can't seem to find past issues in my name. Sorry if I'm duplicating!