Skip to content

Commit

Permalink
fix: DH-18347: Increase panel debounce (#210)
Browse files Browse the repository at this point in the history
DH-18347: Increase panel debounce
  • Loading branch information
bmingles authored Jan 28, 2025
1 parent bd59aa3 commit 8da7550
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Binary file modified releases/vscode-deephaven-latest.vsix
Binary file not shown.
9 changes: 9 additions & 0 deletions src/common/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import * as path from 'node:path';
import type { ConsoleType, VariableType } from '../types';

/**
* This value is a little bit arbitrary, but it needs to be long enough to
* allow panels to update their `visible` property after an `onDidChangeTabs`
* event fires. If we find that we have trouble with lazy panels not loading on
* initial activation, we may need to increase this value. This seems to work
* on a slower VM being used for testing whereas 50ms did not.
*/
export const DEBOUNCE_TAB_UPDATE_MS = 100;

export const EXTENSION_ID = 'vscode-deephaven' as const;

export const CONFIG_KEY = {
Expand Down
9 changes: 7 additions & 2 deletions src/controllers/PanelController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
import { DhcService } from '../services';
import {
CENSORED_TEXT,
DEBOUNCE_TAB_UPDATE_MS,
DEEPHAVEN_POST_MSG,
DH_PANEL_VIEW_TYPE,
OPEN_VARIABLE_PANELS_CMD,
Expand Down Expand Up @@ -74,7 +75,10 @@ export class PanelController extends ControllerBase {
* Load any visible panels that are marked for pending initial load. Calls
* to this method are debounced in case this is called multiple times before
* the active tab state actually settles. e.g. tab change events may fire
* multiple times as tabs are removed, added, etc.
* multiple times as tabs are removed, added, etc. Also, on slower machines,
* there may be some latency between when `onDidChangeTabs` fires and
* `panel.visible` props are updated, so wait long enough to ensure they are
* current.
*/
private _debouncedRefreshVisiblePanelsPendingInitialLoad = (): void => {
clearTimeout(this._debounceRefreshPanels);
Expand Down Expand Up @@ -122,7 +126,8 @@ export class PanelController extends ControllerBase {
this._onRefreshPanelsContent(url, [variable]);
}
});
}, 50);
// See comment on `_debouncedRefreshVisiblePanelsPendingInitialLoad`
}, DEBOUNCE_TAB_UPDATE_MS);
};

/**
Expand Down

0 comments on commit 8da7550

Please sign in to comment.