Skip to content

Commit

Permalink
pageToolbar: increase page detail request timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
ChlodAlejandro committed Feb 22, 2023
1 parent cb639dc commit 3e0f425
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/session/DeputyPageSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@ export default class DeputyPageSession {
* this value should be set to null. This ensures that a generic toolbar is
* used instead of the revision-specific toolbar.
* @param title The title of the page to get information for. Defaults to current.
* @param timeout Timeout for the page detail request.
*/
static async getPageDetails(
revision?: number,
title: mw.Title = window.deputy.currentPage
title: mw.Title = window.deputy.currentPage,
timeout = 500
): Promise<DeputyPageStatusResponseMessage | null> {
return window.deputy.comms.sendAndWait( {
type: 'pageStatusRequest',
page: title.getPrefixedText(),
revision: revision
} );
}, timeout );
}

/**
Expand Down Expand Up @@ -83,7 +85,10 @@ export default class DeputyPageSession {
mw.config.get( 'wgDiffOldId' ) :
// On a "prev" diff page
mw.config.get( 'wgDiffNewId' ) ) ||
mw.config.get( 'wgRevisionId' )
mw.config.get( 'wgRevisionId' ),
window.deputy.currentPage,
// Relatively low-stakes branch, we can handle a bit of a delay.
2000
);

const openPromise = this.appendToolbar( {
Expand Down

0 comments on commit 3e0f425

Please sign in to comment.