The bug
When attaching a lead to a fence while holding fences, the client places the fence that is held for a short time, causing a desync with the server.
To reproduce
Place a fence
Put some more fences in your hotbar
Leash an entity
Select the fences
Attach the lead to the fence
→ ❌ The fences stack appears to be decreased, and neighbouring fences try to connect to where the fence appeared for a split second
Video
[media]Original description
tying a lead to a fence while holding the same kind of fence will use the fence without placing it. right clicking next to a fence doing this can create a glitched fence where it's connected to nothing
Related issues
is duplicated by
Attachments
Comments

Can confirm. I edited the ticket so that it can be more easily found and the description text is more clear. I hope you're fine with that.

I uploaded a video that shows this behavior in 1.15 with a torch in the offhand and a lead in the main hand.

Can confirm in 1.17.1.
Can confirm in 1.18.2 and 22w16b.
Can confirm in 1.19.
Can confirm in 1.19.2.