Set loading state when switching between modes#2795
Conversation
| t: "switchMode", | ||
| mode: newMode, | ||
| }); | ||
| setMethods([]); |
There was a problem hiding this comment.
In practice this works just fine.
The only thing I'm wondering is if it's ok that the methods in ModelEditor and in ModelEditorView are getting temporarily out of sync. Another option could be that when handling the switchMode message, we set ModelEditorView.methods = [] and emit a setMethods message. Ultimately it doesn't matter much because we then call loadExternalApiUsages which updates the methods.
In this case I think this is ok because the methods get recomputed immediately. But it is something to be aware of generally that we need to keep this state in sync.
There was a problem hiding this comment.
Good point, I think setting the methods on the ModelEditorView is better, so I'll update the PR to do that instead.
This sets the loading state when switching between application and framework mode. It does this by setting the
methodsto an empty array, which will show the loading state (methods.length === 0).Checklist
ready-for-doc-reviewlabel there.