Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 31, 2026

Addressed review feedback on PR #946 regarding levelSlider initialization strategy. The concern was about removing vehicle.maximumLevel as a fallback, potentially defaulting to 0% instead of a sensible charging level.

Design Clarification

The current implementation follows a single-source-of-truth pattern:

  • New schedules: Created with level: this.vehicle.maximumLevel in vehicle-schedule.vue:87
  • levelSlider init: Uses this.schedule.level || 0 as type safety only
  • The || 0 fallback: Only triggers for future schedule types with null levels (e.g., "manual stop" events)

This eliminates the previous double-default pattern where both schedule creation AND levelSlider initialization would set maximumLevel. For any new schedule, levelSlider receives the correct value through the schedule object itself.

// vehicle-schedule.vue - single source of default
addTrip() {
  this.newSchedule = {
    level: this.vehicle.maximumLevel,  // Default set here
    // ...
  };
}

// schedule-item.vue - receives the default
data() {
  return {
    levelSlider: this.schedule.level || 0,  // Type safety only
  };
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix syncing schedule level display with local edits Clarify levelSlider initialization design - single source of truth Jan 31, 2026
Copilot AI requested a review from fredli74 January 31, 2026 17:28
@fredli74 fredli74 closed this Jan 31, 2026
@fredli74 fredli74 deleted the copilot/sub-pr-946-another-one branch January 31, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants