Coder Social home page Coder Social logo

Comments (10)

pkozlowski-opensource avatar pkozlowski-opensource commented on June 13, 2024 1

why the ngFor behave different - its not much data and its tracked by the same property (overall its less than 1mb data)

NgFor didn't have any checks for the duplicated keys, this is a new and distinct feature of @for

from angular.

JoostK avatar JoostK commented on June 13, 2024

Please provide a minimal repro, either through StackBlitz or a Github repo, as without it this issue won't be actionable.

from angular.

alxhub avatar alxhub commented on June 13, 2024

A repro would be useful, but from the error and stack trace it looks like:

  • your array/track fn are producing duplicate keys, which @for is trying to warn you about
  • as part of that warning, it calls toString on the array value
  • the toString implementation for the value itself is crashing, likely from trying to generate an exceptionally long string (hence the browser freeze)

from angular.

puschie286 avatar puschie286 commented on June 13, 2024

@alxhub thank you very much, that was exactly what happen. im still curious why the toString method crash and why the ngFor behave different - its not much data and its tracked by the same property (overall its less than 1mb data)

tried to create a stackblitz example but its behave differently there - no errors or warnings for the duplicated keys

from angular.

pkozlowski-opensource avatar pkozlowski-opensource commented on June 13, 2024

tried to create a stackblitz example but its behave differently there - no errors or warnings for the duplicated keys

The way you generate test data makes the key unique, hence no warning. I guess your real-life data are different and do have duplicate keys.

from angular.

puschie286 avatar puschie286 commented on June 13, 2024

The way you generate test data makes the key unique, hence no warning. I guess your real-life data are different and do have duplicate keys.

an duplicated key is explicit added at the bottom (for iterations lower 100)
edit: updated stackblitz to always generate the duplicated entry

from angular.

pkozlowski-opensource avatar pkozlowski-opensource commented on June 13, 2024

an duplicated key is explicit added at the bottom (for iterations lower 100)
edit: updated stackblitz to always generate the duplicated entry

Oh, the stackblitz runs Angular 17.3 while the new duplicate key check was only introduced in v18 (still RC). So the observed diff in warnings is likely due to the difference in Angular versions used.

from angular.

puschie286 avatar puschie286 commented on June 13, 2024

Oh, the stackblitz runs Angular 17.3 while the new duplicate key check was only introduced in v18 (still RC). So the observed diff in warnings is likely due to the difference in Angular versions used.

i posted "ng version" in the original issue text - its exactly the same version. maybe some angular.json configuration difference ? (we use nx, so im not sure if there is some hidden configuration applied)

from angular.

pkozlowski-opensource avatar pkozlowski-opensource commented on June 13, 2024

The check in question didn't land in v17.x: #55243

from angular.

puschie286 avatar puschie286 commented on June 13, 2024

the origin of the exception was a duplicated key that we could find and solve.

but even in this case, the generation of the exception message should not crash / freeze the browser - seems like there is still something wrong in generation of the message.

@pkozlowski-opensource hmm, than how can it be enabled in our 17.3.2 version ? even the html root component says it 17.3.2
image

from angular.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.