-
Hi, The long story short: I would like to be able refresh my tasks in the dashboard if open (this I can check) Here is my function: function M.refresh_dashboard()
if
M.is_dashboard_open()
and M.get_dashboard_config
and type(M.get_dashboard_config) == "function"
then
if Snacks and Snacks.dashboard and type(Snacks.dashboard.update) == "function" then
-- local bufnr = vim.api.nvim_get_current_buf()
-- vim.api.nvim_buf_delete(bufnr, { force = true })
-- Snacks.dashboard.setup(M.get_dashboard_config())
-- Snacks.dashboard.open(M.get_dashboard_config())
Snacks.dashboard.update()
else
local bufnr = vim.api.nvim_get_current_buf()
vim.api.nvim_buf_delete(bufnr, { force = true })
local _dashboard = require("dashboard")
_dashboard.setup(M.get_dashboard_config())
_dashboard:instance()
end
end
end My Snacks.dashboard setup looks like this: local myFunc = require("my-functions")
return {
{
"folke/snacks.nvim",
opts = myFunc.SnacksDashboardSettings(),
},
} When I run Snacks.dashboard.update() nothing happen... I am able to retrieve a new "setup" (with new content) for dashboard. but I have no idea how to re-render it with that new content. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
What is all this for? so |
Beta Was this translation helpful? Give feedback.
-
Hi, This do the trick: Thank you!. |
Beta Was this translation helpful? Give feedback.
What is all this for?
if Snacks and Snacks.dashboard and type(Snacks.dashboard.update) == "function" then
Please provide a simple example of what you want to achieve.
If you need parts to re-render, make sure to wrap those sections in functions so they can be re-evaluated.
so
{function() return {text = "foo"} end}
vs{{text = "foo"}}