filament icon indicating copy to clipboard operation
filament copied to clipboard

fix duplicated index issue

Open egyjs opened this issue 3 years ago • 4 comments

issue :

using relation with multiple same related model (in morph relations ) will cause an issue with "record-id"

1

image

2 :

image

fix

using random ID:

image

egyjs avatar Jul 30 '22 13:07 egyjs

I think this causes the records to be deleted and recreated every time the repeater is saved because Filament is not able to recognise the random ID as the ID of an existing record in the database? Am I correct?

If so, I think this is not the solution, and we will need to close the PR unfortunately

danharrin avatar Aug 01 '22 14:08 danharrin

I think this causes the records to be deleted and recreated every time the repeater is saved because Filament is not able to recognize the random ID as the ID of an existing record in the database? Am I correct?

If so, I think this is not the solution, and we will need to close the PR unfortunately

no, this not the issue

I have a relation table, which is morph table, (one to many) first screen Here I have (one to many) relations, each item can be related more than once The items were retrieved in the old case as follows: record-$id,there are multiple record with the same $id , so the indexes cancel each other except last one, which is logical.

so the fix was to add a random unique string to the indexes

egyjs avatar Aug 01 '22 19:08 egyjs

I understand the problem, I was explaining a new problem that this PR has introduced

danharrin avatar Aug 01 '22 20:08 danharrin

I understand the problem, I was explaining a new problem that this PR has introduced

Hmmmm Oh, I understand now.. i will try to fix this

egyjs avatar Aug 01 '22 21:08 egyjs

Hi, I'm going to close this since the fix doesn't work. Feel free to open a new PR with a working fix.

danharrin avatar Sep 01 '22 22:09 danharrin