I ate a golden apple on previous Minecraft version and left the game. After it was updated to 1.19.20, I logged in and saw that amount on golden hearts was doubled each time I join the game. But when the effect is gone, it won't be renewed.