Lagging object renaming

selection[0].name = "square";
The new name is displayed only after the action
app.executeMenuCommand("AdobeLayerPalette1"); 
redraw();
app.executeMenuCommand("AdobeLayerPalette1");
selection[0].name = "square";
reopenLayersPanel();
function reopenLayersPanel() {
app.executeMenuCommand("AdobeLayerPalette1");
redraw();
app.executeMenuCommand("AdobeLayerPalette1");
}
The new name of the selected object immediately appears in the Layers panel

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store