I had the same very strange error. Inventory disappearing/reappearing, but structures built or blocks placed being preserved.
I read on a different forum that it was caused by the server sometimes using your offline local account, and other times using your online Microsoft account.
I changed "online-mode=true" back to true (the default) from false in the server.properties.
I had switched it to "false" because otherwise I had to fully quit the MineCraft on XBox each time for me to login without authentication errors. A small price to pay to prevent losing your new Diamond boots with five enchants disappearing after logging back in.
On my server the server.properties file is located in /mnt/user/appdaa/binhex-minecraftbedrockserver/minecraft/
online-mode=true
# If true then all connected players must be authenticated to Xbox Live.
# Clients connecting to remote (non-LAN) servers will always require Xbox Live authentication regardless of this setting.
# If the server accepts connections from the Internet, then it's highly recommended to enable online-mode.
# Allowed values: "true" or "false"