mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 19:12:57 +00:00
Make sure we notify webview of view state changes in a consistent order
Send events in the following order: - Non-visible - Visible - Active This matches the old notification order for webviews
This commit is contained in:
parent
dbfca928e0
commit
4b93194b76
1 changed files with 18 additions and 1 deletions
|
@ -299,7 +299,24 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
|||
}
|
||||
|
||||
public $onDidChangeWebviewPanelViewStates(newStates: WebviewPanelViewStateData): void {
|
||||
for (const handle of Object.keys(newStates)) {
|
||||
const handles = Object.keys(newStates);
|
||||
// Notify webviews of state changes in the following order:
|
||||
// - Non-visible
|
||||
// - Visible
|
||||
// - Active
|
||||
handles.sort((a, b) => {
|
||||
const stateA = newStates[a];
|
||||
const stateB = newStates[b];
|
||||
if (stateA.active) {
|
||||
return 1;
|
||||
}
|
||||
if (stateB.active) {
|
||||
return -1;
|
||||
}
|
||||
return (+stateA.visible) - (+stateB.visible);
|
||||
});
|
||||
|
||||
for (const handle of handles) {
|
||||
const panel = this.getWebviewPanel(handle);
|
||||
if (!panel || panel._isDisposed) {
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue