ghostfolio / ghostfolio

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
https://Ghostfol.io
GNU Affero General Public License v3.0
3.79k stars 355 forks source link

Resolve tracking expressions warnings in admin market data details #3494

Open SirZemar opened 1 week ago

SirZemar commented 1 week ago

Duplicated keys warning

Overview

The provided track expression days results in duplicated keys.

Error message

The provided track expression resulted in duplicated keys for a given collection. Adjust the tracking expression such that it uniquely identifies all the items in the collection. Duplicated keys were: 
key "" at index "0" and "1", 
key "" at index "1" and "2", 
key "" at index "2" and "3", 
key "" at index "3" and "4", 
key "" at index "4" and "5", 
key "" at index "5" and "6", 
key "" at index "6" and "7", 
key "" at index "7" and "8", 
key "" at index "8" and "9", 
key "" at index "9" and "10", 
key "" at index "10" and "11", 
key "" at index "11" and "12", 
key "" at index "12" and "13", 
key "" at index "13" and "14", 
key "" at index "14" and "15", 
key "" at index "15" and "16", 
key "" at index "16" and "17", 
key "" at index "17" and "18", 
key "" at index "18" and "19", 
key "" at index "19" and "20", 
key "" at index "20" and "21", 
key "" at index "21" and "22", 
key "" at index "22" and "23", 
key "" at index "23" and "24", 
key "" at index "24" and "25", 
key "" at index "25" and "26", 
key "" at index "26" and "27", 
key "" at index "27" and "28", 
key "" at index "28" and "29", 
key "" at index "29" and "30".

Cause of issue

admin-market-data-detail.component.ts

public days = Array(31); // creates a new array with 31 uninitialized slots

Expensive DOM operations warning

Overview

The Angular template displaying market data encounters performance issues due to improper handling of iteration and tracking within marketDataByMonth.

Error message

NG0956: The configured tracking expression (track by identity) caused re-creation of the entire collection of size 1. 
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://angular.dev/errors/NG0956


Cause of issue

admin-market-data-detail.component.ts

track itemByMonth // should be tracking a unique property from the object, e.g track itemByMonth.key