RocketCommunicationsInc / astro

Astro UXDS is a collection of guidelines, patterns and components for designing space-based user interface applications.
https://astrouxds.com
Other
108 stars 25 forks source link

Rux-Timeline creates error when playhead is "out of range" #1284

Closed danyelleabarnett closed 7 months ago

danyelleabarnett commented 7 months ago

Describe the bug rux-timeline will throw an error when updating the playhead (even if the playhead is set to undefined if going out of range). This appears to be because syncPlayhead is called twice in handleChange.

To Reproduce Stackblitz: https://stackblitz.com/edit/angular-zone-rcdxnp?file=src%2Fapp%2Fapp.component.ts To replicate:

  1. Go forward until playhead disappears.
  2. Go back until playhead reappears.
  3. Error should appear in Console

Current behavior When setting playhead to undefined, then setting start and end to their new values, handleChange appears to be using the old value of playhead in the first syncPlayhead call (before start and end time are updated) and throwing the error.

Expected behavior Throwing an error for a playhead out of range seems excessive - it should probably be a warning or info like with the time regions being out of the current range.

Screenshots image

CodeSandbox Stackblitz: https://stackblitz.com/edit/angular-zone-rcdxnp?file=src%2Fapp%2Fapp.component.ts

Environment (please complete the following information):

Additional context Sometimes appears to cause issues when setting start and end dates from outside sources - such as calendars - that prevent the timeline from updating the dates it's displaying.

micahjones13 commented 7 months ago

Hey @danyelleabarnett, thanks again for opening up these issues! We've changed timeline to no longer emit that error when playhead is undefined. We've also changed it from an error to a warn as per you suggestion, so thank you! This change will be included in the next release, 7.21.0 which will be pushed out this Thursday.