Move hide action logic after `showchange` event If not waiting for `showchange`, the underneath API element may not fully initialized and will throw error when try to setActionHidden. Change-Id: Iaa664f5ed29e56504dd30789c42ab12a4ddcb4db
diff --git a/src/main/resources/static/find-owners.js b/src/main/resources/static/find-owners.js index f47ebad..dce2ead 100644 --- a/src/main/resources/static/find-owners.js +++ b/src/main/resources/static/find-owners.js
@@ -17,8 +17,11 @@ if (ENABLED_EXPERIMENTS.includes('UiFeature__plugin_code_owners')) { // Disable if experiment UiFeature__plugin_code_owners is enabled // Also hide previous 'Find Owners' button under 'MORE'. - var changeActions = self.changeActions(); - changeActions.setActionHidden('revision', 'find-owners~find-owners', true); + function removeFindOwnerFromSecondaryActions() { + var changeActions = self.changeActions(); + changeActions.setActionHidden('revision', 'find-owners~find-owners', true); + } + self.on('showchange', removeFindOwnerFromSecondaryActions); return; }