diff options
author | mehekj <mehek.jethani@gmail.com> | 2023-04-10 16:08:58 -0400 |
---|---|---|
committer | mehekj <mehek.jethani@gmail.com> | 2023-04-10 16:08:58 -0400 |
commit | bff54ce7283f7a50a8c4184ea0543b7a2d338e25 (patch) | |
tree | 26af049cb8549aa75cc376524e123b78adf5a94f /src/client/views/ContextMenu.tsx | |
parent | 7934c38ed641f4a10cd008fe415a50aef1240e10 (diff) | |
parent | 3cb7f85b23eb0ae3a432bbe15b8a2cda37290ce2 (diff) |
Merge branch 'master' into schema-mehek
Diffstat (limited to 'src/client/views/ContextMenu.tsx')
-rw-r--r-- | src/client/views/ContextMenu.tsx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/client/views/ContextMenu.tsx b/src/client/views/ContextMenu.tsx index 6a530e3ae..e4c3e864b 100644 --- a/src/client/views/ContextMenu.tsx +++ b/src/client/views/ContextMenu.tsx @@ -102,13 +102,11 @@ export class ContextMenu extends React.Component { } } @action - moveAfter(item: ContextMenuProps, after: ContextMenuProps) { - if (after && this.findByDescription(after.description)) { - const curInd = this._items.findIndex(i => i.description === item.description); - this._items.splice(curInd, 1); - const afterInd = this._items.findIndex(i => i.description === after.description); - this._items.splice(afterInd + 1, 0, item); - } + moveAfter(item: ContextMenuProps, after?: ContextMenuProps) { + const curInd = this._items.findIndex(i => i.description === item.description); + this._items.splice(curInd, 1); + const afterInd = after && this.findByDescription(after.description) ? this._items.findIndex(i => i.description === after.description) : this._items.length; + this._items.splice(afterInd, 0, item); } @action setDefaultItem(prefix: string, item: (name: string) => void) { |