diff --git a/internal/handlers/dashboard.go b/internal/handlers/dashboard.go index 895e321..5c199e5 100644 --- a/internal/handlers/dashboard.go +++ b/internal/handlers/dashboard.go @@ -210,9 +210,20 @@ func (h *DashboardHandler) GetPreferences(c echo.Context) error { if err != nil { return c.JSON(http.StatusNotFound, map[string]string{"error": "Preferences not found"}) } + + // Normalize nil slices to empty arrays for JSON + hiddenCollections := prefs.HiddenCollections + if hiddenCollections == nil { + hiddenCollections = []string{} + } + collectionOrder := prefs.CollectionOrder + if collectionOrder == nil { + collectionOrder = []string{} + } + return c.JSON(http.StatusOK, map[string]interface{}{ - "hidden_collections": prefs.HiddenCollections, - "collection_order": prefs.CollectionOrder, + "hidden_collections": hiddenCollections, + "collection_order": collectionOrder, "items_per_section": prefs.ItemsPerSection.Int32, }) }