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

Refactor CreateNewTracker to improve efficiency when loading data from DB #36

Open
Issung opened this issue Aug 13, 2023 · 0 comments
Open
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Issung
Copy link
Owner

Issung commented Aug 13, 2023

In GChan/Utils.cs CreateNewTracker(LoadedData data) a tracker is made by creating one from the url from the db, then setting the properties one by one, this looks nasty and will also be spamming NotifyPropertyChanged events one by one to the UI. This will be impacting startup time greatly when the user has a lot of threads saved.

There is a TODO in the code:

// TODO: Should be making trackers based on the LoadedData (pass loadeddata to constructor).
// Rather than making them and then loading them with more data.
// This would help app-startup ui responsiveness as it would reduce the notify property changed spam greatly.

Will require some refactoring of how trackers get made, not much.

  • Make LoadedData (the base class) abstract.
  • Check the type of the loaded data in CreateNewTracker to see if its thread or board.
  • Maybe need a overload for each case that makes a thread/board tracker without checking if its a thread or board.
  • Pass the loaded data into the constructor of the thread/board.
  • Set the properties instantly in the constructor instead of one by one outside the ctor.
  • Clean up remaining code/comments.
@Issung Issung added enhancement New feature or request good first issue Good for newcomers labels Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant