I have been working with repeaters for some time, and recently I have encountered an error in the event context when using OnClick functions, to avoid duplication of OnClick Funtions I’m using the following example: https://www.wix.com/velo/reference/$w/repeater/introduction#$w_repeater_introduction_repeated-item-scope.
Following the example I add this to my code:
let clickedItemData = data . find ( item => item . _id === event . context . itemId );
event.context.itemId should return the ID of the item, in this case is the same ID as the one saved in a Collection so for example " 53a57176-b52d-4b3d-b5e6-887c22822e32".
However recently the event.context is returning something like “item-kqkkmq3” which doesn’t make sense. The data that I’m assigning to the repeater already has the “._id” property and it doesn’t match the one that I’m getting.
This only happens with the live version of my website, but it doesn’t happen all the time.
Update: I discovered that if the repeater is filled with items before using data to populate it, the items sort of remember the old Id, and don’t change it to the new Id, maybe is because the OnClick function is running before the repeater is populated?
Update 2: When a repeater is filled a second time, the ID of the item changes and the repeater automatically ads something like “_p2_p3” at the end of the ID of the item, in the context
Thank you for reporting this issue. Someone from the team will contact you via email.
This issue is now resolved. Please let us know if you continue to experience any problems. Thanks!
@marlowe-shaeffer the event context is still returning the incorrect ID “item-kqmqnq3q” instead of the correct one “53a57176-b52d-4b3d-b5e6-887c22822e32”
Edit: and still the ID has the “_p_2” at the end when the repeater is refilled with new data.
@developer84924 Have you republished your site since we deployed the fix? You might be seeing an old, cached version.
Can you please share the URL for your site so we can investigate? Thanks.
Update: We had to revert the fix because it caused new regressions. I’ll let you know once it’s truly resolved. Sorry for the inconvenience!