diff --git a/tensorboard/plugins/hparams/tf_hparams_dashboard/tf-hparams-dashboard.ts b/tensorboard/plugins/hparams/tf_hparams_dashboard/tf-hparams-dashboard.ts index a5873f65b0..44dafa38b9 100644 --- a/tensorboard/plugins/hparams/tf_hparams_dashboard/tf-hparams-dashboard.ts +++ b/tensorboard/plugins/hparams/tf_hparams_dashboard/tf-hparams-dashboard.ts @@ -20,6 +20,11 @@ import '../tf_hparams_main/tf-hparams-main'; import * as tf_hparams_backend from '../tf_hparams_backend/tf-hparams-backend'; import {LegacyElementMixin} from '../../../components/polymer/legacy_element_mixin'; +// Read URL at module import time, before AppRoutingEffects stomps it. +const inColab = + new URLSearchParams(window.location.search).get('tensorboardColab') === + 'true'; + const PLUGIN_NAME = 'hparams'; @customElement('tf-hparams-dashboard') class TfHparamsDashboard extends LegacyElementMixin(PolymerElement) { @@ -43,7 +48,7 @@ class TfHparamsDashboard extends LegacyElementMixin(PolymerElement) { new tf_backend.RequestManager(), /* Use GETs if we're running in colab (due to b/126387106). Otherwise use POSTs. */ - /* useHttpGet= */ !!((window as any).TENSORBOARD_ENV || {}).IN_COLAB + /* useHttpGet= */ inColab ); // This is called by the tensorboard web framework to refresh the plugin. reload() {