Skip to content

refactor: move I/O operations out of constructors #1498

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

Closed
wants to merge 1 commit into from

Conversation

NathanBaulch
Copy link
Contributor

This is important because constructors cannot be made async. This PR moves I/O operations into static Create factory methods or instance Load methods that are called from OnLoaded view events.

@love-linger
Copy link
Collaborator

This PR will not be merged because I'm refactoring these code in feature/async

@NathanBaulch
Copy link
Contributor Author

Sure. For what it's worth, this PR is a good transitional step towards async without actually introducing any async (which is why I pushed it separately).

@love-linger
Copy link
Collaborator

OnLoad will be triggered at every time this control is added to visual tree. For example: swithing between HISTORIES and LOCAL CHANGES page will trigger the conflict control multi-times.

@NathanBaulch
Copy link
Contributor Author

Fair enough, I admit I'm not familiar with the lifecycle of UI components. Hopefully there's a more appropriate place to put this code outside of view model constructors.

@love-linger
Copy link
Collaborator

I completed the first refactoring of the feature/async branch.

I think we still need Tash.Run in constructors.

@love-linger love-linger self-assigned this Jul 11, 2025
@love-linger love-linger added localization Localization/Translation not-planned It's not planned in the future and removed localization Localization/Translation labels Jul 11, 2025
@love-linger
Copy link
Collaborator

I don't think this modification is necessary. The current code is already quite concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-planned It's not planned in the future
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants