fix: show empty placeholder for empty menus (#546)

This commit is contained in:
natural-harmonia-gropius
2023-05-03 16:46:21 +08:00
committed by GitHub
parent 85618617f7
commit 9960906abb
6 changed files with 9 additions and 4 deletions

View File

@@ -156,7 +156,7 @@ function Menu:update(data)
-- Update items
local first_active_index = nil
menu.items = {}
menu.items = {{title = t('Empty'), value = 'ignore', italic = 'true', muted = 'true'}}
for i, item_data in ipairs(menu_data.items or {}) do
if item_data.active and not first_active_index then first_active_index = i end