fix(dashboard): resolve widget sizing and detection issues
Issue 1: PresentCharacters widget too small with gaps - Increase height from h:3 to h:4 in defaultLayout.js - Widget's defaultSize is h:2 but layout had h:3, creating mismatch - Now properly fills vertical space without gaps Issue 2: Recent Events not appearing in reset/auto-arrange Root cause: previousTrackerConfig starts as null, preventing widget detection Fixes: - Initialize previousTrackerConfig on dashboard load (dashboardIntegration.js) - Deep clone trackerConfig after dashboard init - Enables detectConfigChanges() to work on first load - Reset previousTrackerConfig to null in resetLayout() (dashboardManager.js) - Ensures fresh detection after layout reset - Prevents stale comparison data Verified: Recent Events enabled by default in tracker config (state.js:95) Result: ✅ PresentCharacters fills space properly ✅ Recent Events appears in reset layout ✅ Recent Events appears in auto-arrange ✅ Tracker editor enable/disable now works correctly
This commit is contained in:
@@ -104,6 +104,14 @@ export async function initializeDashboard(dependencies) {
|
||||
dashboardManager.setDefaultLayout(defaultLayout);
|
||||
console.log('[RPG Companion] Default layout set with', defaultLayout.tabs.length, 'tabs');
|
||||
|
||||
// Initialize previousTrackerConfig to enable widget detection on first load
|
||||
// Without this, detectConfigChanges() returns [] because oldConfig is null
|
||||
const settings = dependencies.getExtensionSettings();
|
||||
if (settings?.trackerConfig && dashboardManager) {
|
||||
dashboardManager.previousTrackerConfig = JSON.parse(JSON.stringify(settings.trackerConfig));
|
||||
console.log('[RPG Companion] Initialized previousTrackerConfig for widget detection');
|
||||
}
|
||||
|
||||
// Set up dashboard event listeners
|
||||
setupDashboardEventListeners(dependencies);
|
||||
|
||||
|
||||
@@ -1439,6 +1439,11 @@ export class DashboardManager {
|
||||
console.log('[DashboardManager] Regenerating fresh default layout...');
|
||||
this.defaultLayout = generateDefaultDashboard();
|
||||
|
||||
// Reset previousTrackerConfig for fresh widget detection
|
||||
// This ensures the comparison logic works correctly after reset
|
||||
this.previousTrackerConfig = null;
|
||||
console.log('[DashboardManager] Reset previousTrackerConfig for fresh widget detection');
|
||||
|
||||
if (!this.defaultLayout) {
|
||||
console.warn('[DashboardManager] Failed to generate default layout');
|
||||
return;
|
||||
|
||||
@@ -155,14 +155,14 @@ export function generateDefaultDashboard() {
|
||||
maxEvents: 3
|
||||
}
|
||||
},
|
||||
// Row 6-8: Present Characters (full width, will expand with auto-layout)
|
||||
// Row 6-10: Present Characters (full width, will expand with auto-layout)
|
||||
{
|
||||
id: 'widget-presentchars',
|
||||
type: 'presentCharacters',
|
||||
x: 0,
|
||||
y: 6,
|
||||
w: 2,
|
||||
h: 3,
|
||||
h: 4,
|
||||
config: {
|
||||
cardLayout: 'grid',
|
||||
showThoughtBubbles: true
|
||||
|
||||
Reference in New Issue
Block a user