nvimdev / dashboard-nvim

vim dashboard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When defining more than 6 shortcuts (like 7 shortcuts), it gets frozen

ryoppippi opened this issue · comments

Describe the bug
When defining less than 7 (like 6 shortcuts), it works,
Howerver, when I define 7 shortcuts, the loading screen frozen.
To Reproduce
my config is here

return {
	"glepnir/dashboard-nvim",
	dependencies = { { "nvim-tree/nvim-web-devicons" } },
	event = "VimEnter",
	opts = function()
		return {
			theme = "hyper",
			config = {
				week_header = {
					enable = true,
				},
				shortcut = {
					{
						desc = "Restore Session",
						icon = "",
						icon_hl = "@function",
						action = 'lua require("persistence").load()',
						key = "s",
					},
					{
						desc = "Files",
						icon = "",
						icon_hl = "@variable",
						group = "Label",
						action = "Telescope find_files",
						key = "f",
					},
					{
						desc = "Oil",
						icon = "󰈙 ",
						icon_hl = "@variable",
						group = "Label",
						action = ":Oil",
						key = ".",
					},
					{
						desc = "MRU",
						icon = "",
						group = "DiagnosticHint",
						action = "Telescope oldfiles",
						key = "r",
					},
					{
						desc = "dotfiles",
						icon = "",
						action = "Config",
						key = "d",
					},
					{
						desc = "Lazy",
						icon = "󰒲 ",
						icon_hl = "@property",
						group = "Label",
						action = "Lazy",
						key = "z",
					},
					{
						desc = "Quit",
						icon = "",
						icon_hl = "@property",
						action = "qa",
						key = "q",
					},
				},
			},
		}
	end,
}

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

2023-08-14.10.09.35.mov

I will check it later.

It seems like the issue with random freezes is not directly related to number of shortcuts (but rather to the the large number of long project (and MRU) entries).

I've managed to reproduce the issue by simply putting lots of identical project entries into the dashboard cache file.

Here is the ~/.cache/nvim/dashboard/cache file:

return { 
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
    "/this/is/a/very/long/path/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar",
}

(removing even one of the above entries fixes the freeze)

Here is my dashboard-nvim config I used to reproduce the issue:

-- snip
theme = 'hyper',
config = {
    shortcut = { {
        desc = 'Random entry',
    }, },

    project = { enable = true, limit = 999, },
    mru = { limit = 0 },
},
-- snip

Should be fixed now! This issue can be marked as closed