Button in detail view does same action multiple times


I have a very simple Firebase setup with a page that has a list on the left, and when I select the list it has the detail component on the right that lists all values within that specific document.

I added a button on the detail component which allows the user to duplicate that document into another parent collection.
Essentially it’s a “create document” Firebase action.
Everything works well, except that when I press the button, it says “You are executing … for 4 items”.
Even though I only have one item selected.

EDIT: I think I understand the root cause, but still don’t know how to fix it. One of the items in the document is an array of items. It’s displayed in the detail. It contains 4 items - and it shows this only if that is populated - otherwise it correctly duplicates only one item.
The problem is that it incorrectly sets that specific field in the new document, so something is messed up there.

Thanks a lot!