Edit and run javascript code inside Logseq itself

I’ve noticed that from time to time, the buttons I have defined using your suggested code stop working. This seems to happen more often on my iPhone than on my Mac, but it does happen on both.

It only happens in an already-running Logseq instance, usually after it’s been running for awhile, and after I’ve been doing other things on the device. Restarting Logseq always fixes the problem. Any idea what may be causing this, or how to diagnose and/or fix it?