Messing around with it in Windows 11 singleplayer survival, in my experience it seems like whether or not the item duplicates is dependent on the fullness of certain slots in your inventory or hotbar. For example, I'd fill my inventory with the duplicated items and have to put them in a chest, then it wouldn't work again. For tridents the best way I've found to reproduce is to switch to the slot two slots to the right using number keys, and then that item would be consumed, and the trident would appear between those two slots. (For example have the trident in slot 5 then switch to 2 potatoes in slot 7. The potatoes would disappear and you would have another trident in slot 6.) Although again I've had to be quite fidgety with what/how many items are where in my inventory. This method seems to sometimes but less consistently work with bows as well.
Messing around with it in Windows 11 singleplayer survival, in my experience it seems like whether or not the item duplicates is dependent on the fullness of certain slots in your inventory or hotbar. For example, I'd fill my inventory with the duplicated items and have to put them in a chest, then it wouldn't work again. For tridents the best way I've found to reproduce is to switch to the slot two slots to the right using number keys, and then that item would be consumed, and the trident would appear between those two slots. (For example have the trident in slot 5 then switch to 2 potatoes in slot 7. The potatoes would disappear and you would have another trident in slot 6.) Although again I've had to be quite fidgety with what/how many items are where in my inventory. This method seems to sometimes but less consistently work with bows as well.