Opened 7 years ago

Last modified 5 years ago

#18238 assigned defect

TooltipDialog + dojox/layout/ContentPane loads drop-down content twice on first show

Reported by: Colin Snover Owned by: bill
Priority: undecided Milestone: 1.15
Component: Dijit Version: 1.10.0
Keywords: Cc:
Blocked By: Blocking:


When clicking on the button to display the drop-down, the dijit/form/DropDownButton#isLoaded method is called by dijit/_HasDropDown to determine how to interact with the drop-down component. When this method returns true, the drop-down is simply shown and its _onShow method is called. When this method returns false, DropDownButton#loadDropDown is called instead, which calls the refresh method of the drop-down component, which in the case of ContentPane? causes it to load its content.

Once the content is loaded, ContentPane#_onShow is called. When refreshOnShow is false, this is fine, because _onShow doesn’t do anything extra. However, when refreshOnShow is true, TooltipDialog#refresh gets called again, triggering the duplicate request. This only happens the first request because the DropDownButton#isLoaded method returns true for subsequent clicks on the drop-down button. It also only occurs with the dojox ContentPane? because it introduces an asynchronous rendering codepath. Whereas the default content setter operates synchronously from the time the XHR completes and the time the content is actually rendered, and therefore ContentPane#_xhrDfd exists to prevent the duplicate call to refresh, dojox ContentPane?’s content setter performs additional asynchronous operations (parsing and loading modules), and so the XHR object is deleted (because the XHR is done) before the content is “shown”.

PR forthcoming, since there are zero non-robot tests for this component, and I don’t have time to write something from scratch.

Change History (5)

comment:1 Changed 7 years ago by Colin Snover

Owner: set to bill
Status: newassigned

comment:2 Changed 7 years ago by bill

As I wrote in the PR, if DropDownButton#isLoaded() pretends that the dropdown is loaded when it isn't, it may solve the double-refresh inefficiency, but will cause other problems. We need to keep the order of:

  1. load drop down
  2. position dropdown using
  3. call _onShow()

This order is important so the dropdown positioning works correctly when the size of the dropdown is dependent on step (1).

So instead of that PR, probably there should be an justRefreshed type flag passed to _onShow() to indicate that "we just refreshed your contents, so don't do it again, even though you have a refreshOnShow: true flag setting".

Or alternately, ContentPane? could figure it out for itself, if the call to refresh() was followed by a call to _onShow() with no intermediate call to _onHide().

Last edited 7 years ago by bill (previous) (diff)

comment:3 Changed 7 years ago by bill

PS: Oh, thanks for the detailed description of why the double refresh is happening (and the circumstances where it happens).

comment:4 Changed 6 years ago by dylan

Milestone: tbd1.12

comment:5 Changed 5 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.