Refactor widgets render logic to programmatically determine widget list instead of hardcoded logic
Categories
(Firefox :: New Tab Page, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox152 | --- | fixed |
People
(Reporter: maxx, Assigned: maxx)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
Attachments
(1 file)
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Comment 1•2 months ago
|
||
Replaces hardcoded per-widget checks in Widgets.jsx with a shared WIDGET_REGISTRY defined in a new WidgetsRegistry.mjs. The registry is the canonical source of truth for each widget's pref keys, valid sizes, default order, sidebar placement flag (hasSidebar), and instructions for adding new widgets.
A new widgets.order string pref (CSV of widget IDs) enables future reordering via context menu. Disabled widgets retain their slot in the order array — the pref is only mutated by explicit reorder actions, never by enable/disable. Unknown IDs and duplicates in the saved pref are normalized out; new widgets not yet in the pref are appended in registry-default order.
Sidebar widget logic is extracted from Base.jsx into a new WidgetsSidebar.jsx component, which drives sidebar rendering from the registry's hasSidebar flag rather than ad-hoc pref checks.
A new test in ActivityStream.test.js loops the registry and asserts that each widget's enabledPref and sizePref are registered in PREFS_CONFIG, catching any future widget that is added to the registry but whose prefs are not registered.
Updated•2 months ago
|
Description
•