Skip to content

v22 Date picker generates NG0956 #6827

Description

@vladt22

Bug description:

Date (datetime and range) picker generates the warning below on any month left/right arrow click, time up/down etc. The error (warning) is in the browser console:

NG0956: The configured tracking expression (track by identity) caused re-creation of the entire collection of size 2. This is an expensive operation requiring destruction and subsequent creation of DOM nodes, directives, components etc. Please review the "track expression" and make sure that it uniquely identifies items in a collection. Find more at https://v22.angular.dev/errors/NG0956

How to reproduce:

  • create empty project and add ngx-bootstrap
  • add <input type="text" bsDatepicker> to the template
  • open console and click month change right arrow

ngx-bootstrap: 22.0.0

Angular: 22.1.0

Bootstrap: 5.3.8

Build system: Angular CLI

Expected behavior

No warning should be generated.

The root cause of the problem is tracking by object like

@for (day of week.days; track day)

the

@for (day of week.days; track $index)

fixes it but I'm not sure if this is desired tracking.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions