Skip to content

Commit 3f7bc60

Browse files
committed
fix: add debug logs for the userMenu items
1 parent 663acba commit 3f7bc60

File tree

2 files changed

+70
-1
lines changed

2 files changed

+70
-1
lines changed

adminforth/spa/src/App.vue

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,77 @@ const expandedWidth = computed(() => coreStore.config?.iconOnlySidebar?.expanded
201201
const theme = ref('light');
202202
203203
const userMenuComponents = computed(() => {
204-
console.log('🪲🆕 userMenuComponents recomputed', coreStore?.config?.globalInjections?.userMenu);
204+
console.log('🪲🆕 userMenuComponents recomputed', JSON.parse(JSON.stringify(coreStore?.config?.globalInjections?.userMenu)));
205205
return coreStore?.config?.globalInjections?.userMenu || [];
206206
})
207207
208+
watch(
209+
() => coreStore.config?.globalInjections?.userMenu,
210+
(newVal, oldVal) => {
211+
// Only log when it becomes undefined (you can relax this if needed)
212+
if (newVal === undefined) {
213+
const err = new Error('🔍 userMenu changed to undefined');
214+
console.groupCollapsed(
215+
'%c[TRACE] userMenu changed to undefined',
216+
'color: red; font-weight: bold;'
217+
);
218+
console.log('old value:', oldVal);
219+
console.log('new value:', newVal);
220+
console.log('coreStore.config.globalInjections:', coreStore.config?.globalInjections);
221+
console.log('Stack trace:');
222+
console.log(err.stack);
223+
console.groupEnd();
224+
} else {
225+
// Optional: log ALL changes for debugging
226+
console.groupCollapsed(
227+
'%c[DEBUG] userMenu changed',
228+
'color: orange; font-weight: bold;'
229+
);
230+
console.log('old value:', oldVal);
231+
console.log('new value:', newVal);
232+
console.log('coreStore.config.globalInjections:', coreStore.config?.globalInjections);
233+
console.groupEnd();
234+
}
235+
},
236+
{
237+
deep: false,
238+
immediate: false,
239+
}
240+
);
241+
242+
watch(() => coreStore.config?.globalInjections, (v) => {
243+
console.log("🔧 globalInjections replaced:", v);
244+
}, { deep: false });
245+
246+
watch(
247+
() => coreStore.config?.globalInjections?.userMenu,
248+
(newVal, oldVal) => {
249+
if (newVal === undefined) {
250+
const err = new Error('🔍 userMenu changed to undefined');
251+
console.groupCollapsed(
252+
'%c[TRACE] userMenu changed to undefined',
253+
'color: red; font-weight: bold;'
254+
);
255+
console.log('old value:', oldVal);
256+
console.log('new value:', newVal);
257+
console.log('coreStore.config.globalInjections:', coreStore.config?.globalInjections);
258+
console.log('Stack trace:');
259+
console.log(err.stack);
260+
console.groupEnd();
261+
} else {
262+
console.groupCollapsed(
263+
'%c[DEBUG] userMenu changed',
264+
'color: orange; font-weight: bold;'
265+
);
266+
console.log('old value:', oldVal);
267+
console.log('new value:', newVal);
268+
console.log('coreStore.config.globalInjections:', coreStore.config?.globalInjections);
269+
console.groupEnd();
270+
}
271+
},
272+
{ deep: false, immediate: false }
273+
);
274+
208275
function hideSidebar(): void {
209276
sideBarOpen.value = false;
210277
}

adminforth/spa/src/stores/core.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ export const useCoreStore = defineStore('core', () => {
198198
path: '/get_public_config',
199199
method: 'GET',
200200
});
201+
console.log('📦 getPublicConfig', res);
201202
config.value = {...config.value, ...res};
202203
}
203204

@@ -206,6 +207,7 @@ export const useCoreStore = defineStore('core', () => {
206207
path: '/get_login_form_config',
207208
method: 'GET',
208209
});
210+
console.log('📦 getLoginFormConfig', res);
209211
config.value = {...config.value, ...res};
210212
}
211213

0 commit comments

Comments
 (0)