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, 16 Apr 2020 13:13:26 +0000 (15:13 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/ui.js

index 57f8e2bff4f2625e25edef37729de0fcb6bace15..6d77f37824e064bd15b46c8d08e256da777cfcaa 100644 (file)
@@ -2989,6 +2989,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