If a plugin changes the selection inside executeAsModal and then opens a modal dialog (uxpShowModal) in the same command, Photoshop keeps drawing the old selection’s marching ants until the dialog closes and the command ends. The selection itself has changed (reading it back returns the new one), only the ants are stale.
Minimal repro on github make a selection, click the button. It deselects, then opens a dialog. Expected: no ants. Actual: the old ants are still there.
core.executeAsModal(async () => {
await action.batchPlay([{ _obj: 'set', _target: [{ _ref: 'channel', _property: 'selection' }],
to: { _enum: 'ordinal', _value: 'none' } }], {});
await dialog.uxpShowModal({ title: 'Stale Marching Ants' });
}, { commandName: 'Deselect and Show Dialog' });
app.updateUI() doesn’t redraw them. Opening the dialog after the command ends works, but then the change and the dialog can’t share one history step.
Our real case: a filter resizes the document and carries the selection through the resize, then shows its dialog. The ants show the selection at its old size and position while the preview uses the correct one.
Is there a way to force the ants to redraw inside a command?