[Bug] menuBarInfo not updated correctly (only after canvas focus)

Maybe I’m overlooking something, but it seems like the menuBarInfo property of the app isn’t updated correctly.

I have a function to toggle guide visibility and would like to know the current state of the menu command, but it keeps logging the same value even though the toggling works correctly:

const toggleGuideVisibility = () => {
  const guidesVisible = getAppProperty("menuBarInfo")
    .submenu.find(c => c.menuID === 9) // View
    .submenu.find(c => c.menuID === 59) // Show
    .submenu.find(c => c.command === 3503).checked // Guides
  console.log(guidesVisible)
  performMenuCommand(3503)
}

function getAppProperty(prop) {
  return require("photoshop").action.batchPlay([
    {
      _obj: 'get',
      _target: [{ _property: prop }, { _ref: 'application', _enum: 'ordinal', _value: 'targetEnum' }],
    },
  ], { synchronousExecution: true })[0][prop]
}

function performMenuCommand(commandID: number) {
  require("photoshop").core.performMenuCommand({ commandID });
}

Some further investigation showed that the menu seems to get updated only after the canvas gets focus again.

Just noticed that there’s also the Document property guidesVisibility, however this one is also always true no matter the actual visibility of the guides :confused: