-
-
Notifications
You must be signed in to change notification settings - Fork 379
Fix issue that mainVM fails to work #3296
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
Fix issue that mainVM fails to work #3296
Conversation
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, or 📝 job summary for details.
See ❌ Event descriptions for more information. If the flagged items are 🤯 false positivesIf items relate to a ...
|
🥷 Code experts: no user but you matched threshold 10 Jack251970 has most 👩💻 activity in the files. See details
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame: To learn more about /:\ gitStream - Visit our Docs |
Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX. |
📝 WalkthroughWalkthroughThe pull request updates the initialization flow of the application by decoupling the MainViewModel assignment from the constructor of the PublicAPIInstance. In the startup method of the application, the PublicAPIInstance is explicitly initialized with the MainViewModel via an added method call. Simultaneously, the PublicAPIInstance class is refactored to allow delayed assignment of its MainViewModel field. No other parts of the control flow or public declarations have been modified. Changes
Sequence Diagram(s)sequenceDiagram
participant App as Application
participant API as PublicAPIInstance
participant MainVM as MainViewModel
App->>API: OnStartupAsync()
App->>API: Initialize(mainVM)
API->>API: Set _mainVM = mainVM
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
⏰ Context from checks skipped due to timeout of 90000ms (2)
🔇 Additional comments (4)
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@taooceros Hello, after testing on a fresh Windows system, I have confirmed that the issue occurs consistently. Earlier, you mentioned you couldn’t reproduce the behavior, and I initially suspected it might be specific to my system. However, it appears to be a broader issue. |
yeah I think I could reproduce now. Maybe previously the version is messed up. Sorry for the confusion. |
How about we firstly create the mainviewmodel and pass that instance to the dependency injection. Would that also fix the issue? |
Let me check. IIRC, it cannot fix this issue. |
No, we cannot do that. Because Updater will call API construction firstly.
|
I think it's important to understand why this is happening. Does this problem happen when build with VS? |
I am still checking. |
Yes. |
That's good, so we don't have to test the appveyor build to understand why. I need to be afk for a while. |
Certainly! For now I found that |
Oh if that's the case then things can certainly goes wrong. It can link to the wrong publicapiinstance (which associate with a wrong mainviewmodel), which causes the problem. Let's try to figure out where's the problem. |
Ok, I found the reason. I will close this PR, and create a new one. |
From #3275.
We should not create
MainViewModel
when creating API instance in constructor because it can cause unknown issue that makes all functions related to _mainVM in API instance cannot work.Test
Originally (Tested in VMWare, installed latest dev branch version 65f85cf)
2025-02-28.15-59-05.mp4
Because installing & uninstalling plugins need _mainVM to
ChangeQuery
andShowWindow
so nothing happens when _mainVM fails to work.After