From cb2cef5e73c959f57f8ab52164ae72698a6a1834 Mon Sep 17 00:00:00 2001 From: Andy Lee Date: Wed, 16 Sep 2026 09:31:28 +0800 Subject: [PATCH] fix: avoid userpreferences PUT flood from SideNav refresh trigger (#1119) kickSideNav toggled a dummy favorite via addFavorite/removeFavorite, which persist through prefs/set and issue a PUT /v1/userpreferences on every toggle, flooding the backend and surfacing 500 errors. Switch to the in-memory prefs/load mutation so the SideNav still re-renders without any network request. Signed-off-by: Andy Lee --- pkg/harvester/utils/dynamic-nav.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/harvester/utils/dynamic-nav.js b/pkg/harvester/utils/dynamic-nav.js index 4909e3c9..91f0a590 100644 --- a/pkg/harvester/utils/dynamic-nav.js +++ b/pkg/harvester/utils/dynamic-nav.js @@ -1,3 +1,5 @@ +import { FAVORITE_TYPES } from '@shell/store/prefs'; + /** * Dynamically toggles SideNav entries based on the enabled status of a specific Addon. * @@ -26,10 +28,13 @@ export function registerAddonSideNav(store, productName, { // Toggle the trigger a few times so an early kick (fired before the SideNav // has mounted on first login) is retried once the component is listening. + // Use the prefs/load mutation (in-memory only) [0, 600, 1500].forEach((delay) => { setTimeout(() => { - store.dispatch('type-map/addFavorite', TRIGGER); - setTimeout(() => store.dispatch('type-map/removeFavorite', TRIGGER), 300); + const base = (store.getters['prefs/get'](FAVORITE_TYPES) || []).filter((t) => t !== TRIGGER); + + store.commit('prefs/load', { key: FAVORITE_TYPES, value: [...base, TRIGGER] }); + setTimeout(() => store.commit('prefs/load', { key: FAVORITE_TYPES, value: [...base] }), 300); }, delay); }); };