Menu refresh fails for separators


I’m trying to add some new features fo favorites package and I’ve got this show stopper.

Added this in .atom/init.js

let favoritesMenu = undefined  // disposable menu

atom.commands.add('atom-workspace', '000:Refresh', event => {
atom.commands.add('atom-workspace', '000:Dispose', event => {

function refresh(){
  const favoriteMenuItems = []
  favoriteMenuItems.push({ label: 'item1'})
  favoriteMenuItems.push({ type: 'separator'})
  favoriteMenuItems.push({ label: 'item2'})

  favoritesMenu = ([
      label: 'File',
      submenu : [{
        label: 'Test',
        submenu: favoriteMenuItems

function dispose(){


If I execute command 000:Refresh multiple times I end up with this

When I do 000:Dispose it removes all items except for separator.

I thought favoritesMenu.dispose() will do its job of removing all items. Seems it forgets about separators.

I ran out of ideas. Any help would be much appreciated.



I have tried your tasks in the development console. My findings support your findings which I now repeat in descriptions below.

The result is:

My observations:

  • Creating the menu items the first time works like expected.

  • When the object is disposed the “Test” item remains with an “empty” sub-menu. In actual fact the “sub-menu” is not empty - it has a separator.

  • The left-over separator remains when you call the re-creation of the menu.

  • When disposing the object and then restarting Atom, makes the “Test” menu item to go away. That makes me wonder if an update trigger is not required.

I have no solution for you.


update… Occurrence reported on: