The Bug:
Client-side desyncs can still occur when using the "/item" command repeatedly.
It appears that MC-219018 wasn't fully fixed as you can still reproduce this when placing blocks.
Steps to Reproduce:
Summon a repeating command block that will constantly replace the first slot in your hotbar with dirt by using the command provided below.
/setblock ~ ~ ~ minecraft:repeating_command_block{Command:"/item replace entity @p hotbar.0 with minecraft:dirt",auto:1b}
Switch into survival mode and place down the dirt.
Take note as to whether or not a new piece of dirt can be visually seen in your first hotbar slot.
Check to see if any dirt is present in your inventory by using the command provided below.
/data get entity @s Inventory
Take note as to whether or not client-side desyncs can still occur when using the "/item" command repeatedly.
Observed Behavior:
Client-side desyncs can still occur.
Expected Behavior:
Client-side desyncs would not occur.
Linked issues
discovered while testing 1
is duplicated by 11
relates to 2
Attachments
Comments 11

Can confirm. The ghost item can be updated by clicking in the slot it should be (the same behaviour as MC-219018)
The only difference now seems to be that the player doesn't need to drop the item to 'trigger' the bug

@MMK21 You don't need to drop an item in order for either of them to work. Dropping an item is (I believe) only done as a demonstration, since the observed behavior happens when the block is placed, regardless of previous actions.
These issues are identical, so this report clones MC-219018.

Affects 1.18.2

Turns out I reproduced this glitch without even knowing.

Can confirm in 1.20.3 Release Candidate 1

Can confirm in 1.20.4 Release Candidate 1

Can confirm in 24w12a
In this snapshot, with the addition of the food item component, which allows to detect right-clicks in a versatile and easy-to-implement way, this bug becomes more pressing. When re-filling a slot from an item that has been eaten, the item given using /item replace of /give is always a ghost item.
Steps to reproduce:
Install the datapack provided
Give yourself an item with
/give @s minecraft:arrow[minecraft:food={"saturation_modifier":0,"nutrition":0,"can_always_eat":true,"eat_seconds":0.05},minecraft:max_stack_size=1]
Right click this item
Observe that even though the item gets refilled server-side by the datapack, it does not re-appear client-side

Since this bug happens even when the item command is not being spammed/run on repeat, but rather just when the command is used in general, it is a separate issue from the other bug report. The description should be updated to reflect that information to make it more clear that it's a separate issue despite the outcome of both being the same (ghost items being created).

Can reproduce in 1.21.1 with a datapack:
function called from tick.json
:
execute as @a[nbt=!{Inventory:[{id:"minecraft:dirt"}]}] run function datapack:give
give.mcfunction
:
give @s minecraft:dirt
When dropping the dirt, a new one correctly appears in the inventory, when placing it, the new one is invisible.
Correct me if I'm wrong but I believe this issue clones MC-219018 as it wasn't fully fixed.