Skip to content

[scheduler] Remove non-functional onPreferencesChange prop from EventTimelinePremium #22739

@rita-codes

Description

@rita-codes

Summary

EventTimelinePremium exposes a public onPreferencesChange prop, but it is never fired — the Timeline has no internal mechanism to change preferences (no preferences menu / toggle, no setPreferences method on its store). It's a dead public prop and should be removed before the stable release, since removing it afterwards would be a breaking change.

(No preferences-editing UI is planned for the Timeline right now. If it's added later, the callback should be reintroduced with the correct signature — see note below.)

Details

The only runtime call site of onPreferencesChange in the whole repo is EventCalendarStore.ts (setPreferences), which the EventCalendar's PreferencesMenu drives:

// EventCalendarStore — works: fires the callback
public setPreferences = (partial, event) => {
  const eventDetails = createChangeEventDetails('none', event);
  onPreferencesChange?.(updated, eventDetails);
  if (!eventDetails.isCanceled && preferencesProp === undefined) {
    this.set('preferences', updated);
  }
};

The Timeline store has no equivalent: it only reads preferences / defaultPreferences at init and syncs the controlled prop into state — there is no internal preferences change, so onPreferencesChange never runs.

Note: preferences / defaultPreferences themselves are useful and should stay — ampm is read in TimelineGridHeader to format the header times (12h/24h), and they support controlled usage.

Secondary issue (resolved by removal): the Timeline's onPreferencesChange also had an inconsistent signature — event: React.UIEvent | Event instead of the eventDetails: SchedulerChangeEventDetails used everywhere else (including the Timeline's own onPresetChange).

Suggested fix

Remove onPreferencesChange from the Timeline's public surface:

  • the prop declaration in EventTimelinePremiumStore.types.ts (EventTimelinePremiumParameters)
  • the PropTypes entry in EventTimelinePremium.tsx
  • the extraction in useExtractEventTimelinePremiumParameters.ts

If preferences editing is added to the Timeline in the future, reintroduce onPreferencesChange with the standard (preferences, eventDetails: SchedulerChangeEventDetails) => void signature and wire it through a setPreferences method (mirroring EventCalendarStore).

Context

@mui/x-scheduler-premium (master, pre-stable).

Metadata

Metadata

Assignees

Labels

scope: schedulerChanges related to the scheduler.type: enhancementIt’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions