My code does not work anymore, I do not get error notifications.

I have a list page that takes the page of the item, I have a Favorites button that adds the current item to another member list.

Adding the current item to favorites works more remove the item does not work, is my code missing anything?

export function button18_click() {
 const item = $w('#dynamicDataset').getCurrentItem();
    wixData.insert('Favoritostest2', { item });
}
export function button19_click() {
 const item = $w('#dynamicDataset').getCurrentItem();
    wixData.removeReference('Favoritostest2', { item });
}

Make sure that you are using the field key and not the field name.


You don’t want:
Favoritostest2
You want this instead:
favoritostest2

I do not know how to explain it well, let’s break it down.
I have a dynamic item page where everything is linked to the database (AnimeList) and the dataset is called (dynamicDataset).

Part 1 of the code
The first part of the code takes the current has and adds a reference to it in another database with the name (Favoritostest2) that only those who added it can see.

export function button18_click() {
 const item = $w('#dynamicDataset').getCurrentItem();
    wixData.insert('Favoritostest2', { item });
}

Part 2 of the code

export function button19_click() {
 const item = $w('#dynamicDataset').getCurrentItem();
    wixData.removeReference('Favoritostest2', { item });
}

I thought the line * const item = $w(‘#dynamicDataset’).getCurrentItem(); * would pick up the current item and on the second line * wixData.removeReference(‘Favoritostest2’, { item }); *
would remove the item that was the same from the database (Favoritostest2)