Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Answer:32 #929

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Answer:32 #929

wants to merge 1 commit into from

Conversation

Sanjar1304
Copy link

fixed cd-bug with for track and signals

fixed cd-bug with for track and signals
@github-actions github-actions bot added 32 bug change detection answer answer contributor highly contributing to the project to be reviewed PR requests a review labels May 17, 2024
@tomalaforge
Copy link
Owner

Nice, but did you understand what was the issue ?

@tomalaforge tomalaforge removed the to be reviewed PR requests a review label May 21, 2024
@Sanjar1304
Copy link
Author

Without the track in for loop, menu will be created and removed from the start till the end of iterating source and DOM UI will be updated in amount of source. That will affect to the browsers rendering speed. In order to optimize this condition, track function is recommended to use in for loop. Because track funtion only gets unique data of source iterating object and only update the exact changed item of the unique data of source iterating object. It gives us performance optimization by speeding up DOM UI rendering in browser. And I also converted data coming from backend to signal. And returning data by checking if data's path is foo or bar, otherwise returning empty string. Signals share changes with each other under the hood effectively. That's why I used them.

@tomalaforge
Copy link
Owner

Indeed trackby will not update the DOM is the updated list have the same element. But this behavior will only hide the real issue in the code.
Why is the list updated? You should answer this question to understand the real issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
32 bug change detection answer answer contributor highly contributing to the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants