Skip to content

Commit

Permalink
feat(week-view): track by a unique row id instead of the index
Browse files Browse the repository at this point in the history
  • Loading branch information
mattlewis92 committed Oct 13, 2018
1 parent fef1b04 commit 481eb02
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 53 deletions.
89 changes: 45 additions & 44 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"dependencies": {
"angular-draggable-droppable": "^4.0.2",
"angular-resizable-element": "^3.2.2",
"calendar-utils": "^0.2.1",
"calendar-utils": "0.3.0-beta.1",
"positioning": "^1.4.0"
},
"sideEffects": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import {
WeekViewHourColumn,
DayViewEvent,
DayViewHourSegment,
DayViewHour
DayViewHour,
WeekViewAllDayEventRow
} from 'calendar-utils';
import { ResizeEvent } from 'angular-resizable-element';
import { CalendarDragHelper } from '../common/calendar-drag-helper.provider';
Expand All @@ -33,7 +34,6 @@ import {
import { CalendarUtils } from '../common/calendar-utils.provider';
import {
validateEvents,
trackByIndex,
roundToNearest,
trackByWeekDayHeaderDate,
trackByHourSegment,
Expand Down Expand Up @@ -107,7 +107,7 @@ export interface CalendarWeekViewBeforeRenderEvent extends WeekView {
</div>
</div>
<div
*ngFor="let eventRow of view.allDayEventRows; trackBy:trackByIndex"
*ngFor="let eventRow of view.allDayEventRows; trackBy:trackById"
#eventRowContainer
class="cal-events-row">
<div
Expand Down Expand Up @@ -533,11 +533,6 @@ export class CalendarWeekViewComponent implements OnChanges, OnInit, OnDestroy {
*/
calendarId = Symbol('angular calendar week view id');

/**
* @hidden
*/
trackByIndex = trackByIndex;

/**
* @hidden
*/
Expand All @@ -564,6 +559,11 @@ export class CalendarWeekViewComponent implements OnChanges, OnInit, OnDestroy {
trackByHourColumn = (index: number, column: WeekViewHourColumn) =>
column.hours[0] ? column.hours[0].segments[0].date.toISOString() : column;

/**
* @hidden
*/
trackById = (index: number, row: WeekViewAllDayEventRow) => row.id;

/**
* @hidden
*/
Expand Down

0 comments on commit 481eb02

Please sign in to comment.