Bug: system.perspective.alterdock doesn't work correctly if more than 1 dock is defined

8.3

I have a dock mounted on the right called right_faceplate, on it there are two buttons, small, and large, which execute this on click. With size either 500 or 800. The idea is to have a faceplate with the trend on it and when they click on large it expands to show the trend larger.

		system.perspective.alterDock('right_faceplate', { 'size': 500 } )

I built this in a dev environment and it worked fine but when I tried to push it into a larger project it would not work. Eventually I troubleshooted it down to it only seems to work if there is only one faceplate defined in the page configuration. If only right_faceplate is defined the small and large buttons work perfectly going back and forth size. If I add right_test, even though it isn’t referenced anywhere in the project, the code breaks and no longer works correctly. Clicking either button appears to briefly try to change the size for a single frame then the dock disappears and it launches right_test.

Some additional testing led me to find the following:

  • Alterdock properly sets the size of the requested faceplate, this happens regardless if faceplate_right is open, a different dock is open, or there is no dock open at all.
  • The bug only occurs if the requested faceplate is open at the time alterddock is called. Then alterdock sets the correct dock size but then opens a different faceplate
  • It always opens the same, wrong, faceplate. Even adding a third dock into the mix, it always appears to open the same incorrect one each time.
  • The dock_ids are never affected, every combination of dock still correctly responds to .closeDock and .openDock.
  • It also only happens when docks are set to ‘onDemand’. Changing it to visible or auto removes the issue.
  • Deleting right_faceplate, then re-adding it so it’s at the bottom of the list of docks then shifts the bug to always show it when running alterdock on a different dock.

Which leads me to believe:

  • Something in the backend code of alterdock, is referencing the wrong dock, only when the altered dock is already open.

Also this spaghetti fix correctly works and bypasses the issue, though occasionally there is a visual flicker while it’s executing which is mildly annoying:

			system.perspective.closeDock('right_faceplate')
			system.perspective.alterDock('right_faceplate', { 'size': 500 } )
			system.perspective.openDock('right_faceplate')

The buttons to replicate different scenarios and test:

I did find this reference when trying to originally look into this issue. I thought I’d post my findings in hopes of this issue getting some attention as the original issue from 2022 still hasn’t been looked at. I hope narrowing it down and providing more troubleshooting steps can maybe get IA to consider looking at this.