Refactor events to fix the method modeling panel getting stuck showing "start modeling"#3439
Merged
robertbrignull merged 7 commits intomainfrom Mar 6, 2024
Merged
Conversation
…hich we already listen to
norascheuch
approved these changes
Mar 6, 2024
Contributor
norascheuch
left a comment
There was a problem hiding this comment.
The code changes look good! I haven't tested it locally though.
Contributor
Author
|
I've been playing around with it trying to test it manually and I haven't found any bugs or anything else wrong. |
This was referenced Mar 6, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes the method modeling panel getting stuck showing "start modeling" if you open the model editor before you open the QL sidebar panel.
The problem was that when the webview loaded we weren't setting the
languagefield correctly in the webview. There needs to be a call tosetViewState()after determining the language.I recommend reviewing commit by commit.
The actual fix is made in d441342 which is the third commit. The two commits before that are refactoring methods so we can reuse code. For this fix I've not worried about being inefficient with sending webview messages. For example since
setDatabaseItemcallssetViewStatewe don't have to call it before in this case, but I felt the complexity of having branches and relying on methods always calling other methods was not worth the minimal cost of callingsetViewStatetwice when loading initial data.The commits after the fix could be moved to a separate PR if preferable. I noticed another potential bug which was that we had both the
setMethodand thesetSelectedMethodwebview messages which both set the method in the view butsetMethoddoesn't contain all the other fields. This could mean if we usedsetMethodwe could end up with state likeisModifiedormodeledMethodsbeing outdated and incorrect. Luckily we avoided the bug because every time we did callsetMethod(except when setting the method toundefined) we also calledsetSelectedMethod, so essentiallysetMethodis unnecessary. Indeed we can remove it and replace it withsetSelectedMethodand a newsetNoMethodSelectedmessage and also simplify class interfaces by changing where we listen to modeling store events from.Checklist
ready-for-doc-reviewlabel there.