Closed Bug 2013978 Opened 4 months ago Closed 2 months ago

Refactor widgets render logic to programmatically determine widget list instead of hardcoded logic

Categories

(Firefox :: New Tab Page, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
152 Branch
Tracking Status
firefox152 --- fixed

People

(Reporter: maxx, Assigned: maxx)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

Attachments

(1 file)

No description provided.
Summary: Refactor "hide all widgets" to programmatically determine widget list instead of hardcoded logic → Refactor widgets render logic to programmatically determine widget list instead of hardcoded logic

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.

Assignee: nobody → mcrawford
Status: NEW → ASSIGNED
Depends on: 2030973
Depends on: 2034542
Pushed by sdowne@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/02d8cda00b8d https://hg.mozilla.org/integration/autoland/rev/375618591b6f Introduce WIDGET_REGISTRY and widgets.order pref r=home-newtab-reviewers,thecount
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 152 Branch
See Also: → 2036902
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: