Skip to content

Cancel pending combo type-ahead when the Apply Template window closes - #1235

Closed
labkey-jeckels wants to merge 2 commits into
developfrom
fb_ehr_test_flake_fixes
Closed

labkey-jeckels wants to merge 2 commits into
developfrom
fb_ehr_test_flake_fixes

Conversation

@labkey-jeckels

Copy link
Copy Markdown
Contributor

Rationale

Clicking Submit on the Apply Template window within 250ms of picking a section template throws a client-side error. The combo's delayed type-ahead fires after the window is destroyed, against a store that no longer exists. Users can hit this, and it made TNPRC_RequestsTest fail intermittently.

Related Pull Requests

Changes

  • Cancel any pending combo type-ahead when the template window is destroyed

Tasks

  • Claude Code Review
  • Manual Testing
  • Test Automation
  • Verify Fix

@bbimber

bbimber commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@labkey-jeckels, the diagnosis of the failure might be correct, but isnt it odd if this is the one place in EHR where special cleanup is needed? There's hundreds of combos like this, including ones in windows that get destroyed. This makes me wonder if there isnt actually a simple configuration problem with this combo. There's even another similar combo in this window. I dont see any reason this one combo should be a different case from any other; however:

  • It might make more sense for it to use xtype: 'labkey-combo', rather than 'combo' (line 206). This might let it inherit other Ext4 config. I dont see a smoking gun reason this would change behavior though.
  • I dont think it's necessary to specify "typeahead: true" on line 219. I think 'queryMode:local' should make auto-complete work. I see typeahead:true specified some of the time in EHR, but also plenty of times on combos that have working auto-complete behavior without it. Dropping that line might be a simple solution.

If this problem from delayed typeahead events occurs more often than I appreciate, pushing the fix into LabkeyCombo.js and making this instance inherit from labkey-combo rather than vanilla 'combo', would fix the potential intermittent problem in more cases. Gemini suggested this; however, your onDestroy logic might also be fine:

    onTypeAhead: function() {
        // Strict guard clause preventing execution on dead components/stores
        if (this.destroyed || this.isDestroyed || !this.getStore() || this.getStore().isDestroyed) {
            if (this.typeAheadTask) {
                this.typeAheadTask.cancel();
            }
            return;
        }
        this.callParent(arguments);
    }

FWIW, FormTemplateWindow appears to have been cut/paste into ONPRC EHR's module, so would have the same problem as this.

@labkey-jeckels

Copy link
Copy Markdown
Contributor Author

@bbimber I'm experimenting with having Claude try to fix intermittent EHR test failures semi-automatically. Of the half dozen or so that I tried, it had a mixed success rate of getting to the root cause vs doing a localized workaround. I agree this one didn't land in the right spot. I had it open PRs as a way for me to review its changes and didn't intend to have others look at them yet (I failed to tell it to mark them as draft), but thanks for the feedback regardless.

If you're interested, here's the next turn (not yet validated):

LabKey/platform#8286

@labkey-jeckels
labkey-jeckels deleted the fb_ehr_test_flake_fixes branch November 4, 2026 00:45
@bbimber

bbimber commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

@bbimber I'm experimenting with having Claude try to fix intermittent EHR test failures semi-automatically. Of the half dozen or so that I tried, it had a mixed success rate of getting to the root cause vs doing a localized workaround. I agree this one didn't land in the right spot. I had it open PRs as a way for me to review its changes and didn't intend to have others look at them yet (I failed to tell it to mark them as draft), but thanks for the feedback regardless.

If you're interested, here's the next turn (not yet validated):

LabKey/platform#8286

sure, no problem. It would be nice if the broader EHR test landscape was more reliable.

My ExtJS is not used much, but I still would bet that opting out of typeahead=true would also solve this. There is a subtle difference between typeahead (completing text in the box) and filtering the combo selection. While EHR is not 100% consistent, most combos do not turn on typeAhead and it gives a perfectly fine user behavior.

Nonetheless, your Ext4 override seems reasonable (though I did zero testing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants