luci-base: ui.js: add LuCI.ui.menu.flushCache() function
authorJo-Philipp Wich <jo@mein.io>
Thu, 16 Apr 2020 13:13:26 +0000 (15:13 +0200)
committerJo-Philipp Wich <jo@mein.io>
Thu, 7 May 2020 17:40:50 +0000 (19:40 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 90a51ab3b9afca0144a93eb967fcd72a230732f0)

modules/luci-base/htdocs/luci-static/resources/ui.js

index 67d3497d038dbc68020cbdf10795a2fc86ee9879..06520f7f8ccd3caef4d88b35c677e66200be6bd8 100644 (file)
@@ -2996,6 +2996,14 @@ var UIMenu = baseclass.singleton(/** @lends LuCI.ui.menu.prototype */ {
                return Promise.resolve(this.menu);
        },
 
+       /**
+        * Flush the internal menu cache to force loading a new structure on the
+        * next page load.
+        */
+       flushCache: function() {
+               session.setLocalData('menu', null);
+       },
+
        /**
         * @param {LuCI.ui.menu.MenuNode} [node]
         * The menu node to retrieve the children for. Defaults to the menu's