Solved: How do I get a panel field to update when the page status changes?

I’m handing over the isDraft boolean of the page to my panel field and use it to hide some buttons when it’s a draft. Once the user changes the status the buttons should re-appear. I expected this to happen automatically since it’s vue but looks like I have to activate something to get the vue magic rolling.

In the index.php the isDraft is a computed value. In the frontend code I receive the isDraft value in the props object.

In the core panel fields I see the usage of the page.changeStatus event. Maybe that’s a lead?

Update: found out that I need to write my own api endpoint that returns the isDraft status. I hook into the page.changeStatus event in the frontend and update the isDraft value. This works … for a split second after the status change before it somehow resets the value…

Update 2: I forgot about data(). Only the values listed in data() update dynamically. So I moved isDraft into data() and now it persists the “reset”. Yay!