Instead of using dataset.show for these, just add/remove the 'collapsed' style.  Since classList.add/remove can be annoying to toggle between, it might be easiest to just initially mark all the buttons with the collapsed class.  And then if the bit is set, you can remove the class.

This will also remove the need to call updateContextMenu(0).  Just call it once when the contact has been looked up and the correct result will net out.