Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tensorbored/components/tf_categorization_utils/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ tf_ts_library(
"//tensorbored/components/polymer:irons_and_papers",
"//tensorbored/components/tf_backend",
"//tensorbored/components/tf_backend:type",
"//tensorbored/components/tf_storage",
"//tensorbored/components/vz_sorting",
"@npm//@polymer/decorators",
"@npm//@polymer/polymer",
Expand Down
15 changes: 3 additions & 12 deletions tensorbored/components/tf_categorization_utils/tf-tag-filterer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ limitations under the License.
import {customElement, property} from '@polymer/decorators';
import {html, PolymerElement} from '@polymer/polymer';
import '../polymer/irons_and_papers';
import {getStringInitializer, getStringObserver} from '../tf_storage/storage';

@customElement('tf-tag-filterer')
class TfTagFilterer extends PolymerElement {
Expand Down Expand Up @@ -46,19 +45,11 @@ class TfTagFilterer extends PolymerElement {

@property({
type: String,
observer: '_tagFilterObserver',
})
_tagFilter: string = getStringInitializer('tagFilter', {
defaultValue: '',
useLocalStorage: false,
polymerProperty: '_tagFilter',
}).call(this);
_tagFilter: string = '';

_tagFilterObserver = getStringObserver('tagFilter', {
defaultValue: '',
useLocalStorage: false,
polymerProperty: '_tagFilter',
});
// Tag filter is no longer persisted to the URL hash.
// It is managed via Angular query params ('tagFilter').

_computeTagFilter() {
return this._tagFilter;
Expand Down
1 change: 0 additions & 1 deletion tensorbored/components/tf_runs_selector/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ tf_ts_library(
"//tensorbored/components/tf_backend",
"//tensorbored/components/tf_color_scale",
"//tensorbored/components/tf_dashboard_common",
"//tensorbored/components/tf_storage",
"//tensorbored/components/tf_wbr_string",
"@npm//@polymer/decorators",
"@npm//@polymer/polymer",
Expand Down
25 changes: 5 additions & 20 deletions tensorbored/components/tf_runs_selector/tf-runs-selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {environmentStore} from '../tf_backend/environmentStore';
import {runsStore} from '../tf_backend/runsStore';
import {runsColorScale} from '../tf_color_scale/colorScale';
import '../tf_dashboard_common/tf-multi-checkbox';
import * as storage from '../tf_storage/storage';
import '../tf_wbr_string/tf-wbr-string';

@customElement('tf-runs-selector')
Expand Down Expand Up @@ -116,23 +115,13 @@ class TfRunsSelector extends LegacyElementMixin(PolymerElement) {

@property({
type: Object,
observer: '_storeRunSelectionState',
})
runSelectionState: object = storage
.getObjectInitializer('runSelectionState', {
defaultValue: {},
})
.call(this);
runSelectionState: object = {};

@property({
type: String,
observer: '_regexObserver',
})
regexInput: string = storage
.getStringInitializer('regexInput', {
defaultValue: '',
})
.call(this);
regexInput: string = '';

@property({
type: Array,
Expand Down Expand Up @@ -216,11 +205,7 @@ class TfRunsSelector extends LegacyElementMixin(PolymerElement) {
return dataLocation && dataLocation.length > _dataLocationClipLength;
}

_storeRunSelectionState = storage.getObjectObserver('runSelectionState', {
defaultValue: {},
});

_regexObserver = storage.getStringObserver('regexInput', {
defaultValue: '',
});
// Run selection state and regex are no longer persisted to the URL hash.
// Run selection is managed via localStorage (runs_effects.ts).
// Regex filter is managed via Angular query params ('runFilter').
}
24 changes: 24 additions & 0 deletions tensorbored/components/tf_storage/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,22 @@ export function makeBindings<T>(
}
return {get, set, getInitializer, getObserver, disposeBinding};
}
/**
* Hash param keys that are now managed elsewhere (localStorage or Angular
* query params) and should be removed from the URL hash to prevent
* accumulation. See https://github.com/Demonstrandum/tensorbored/issues/42.
*/
const LEGACY_HASH_PARAMS_TO_REMOVE: ReadonlySet<string> = new Set([
// Run selection is now persisted to localStorage via runs_effects.ts
'runSelectionState',
// Smoothing is now an Angular query param ('smoothing')
'_smoothingWeight',
// Tag filter is now an Angular query param ('tagFilter')
'tagFilter',
// Run regex is now an Angular query param ('runFilter')
'regexInput',
]);

export function migrateLegacyURLScheme() {
/**
* TODO(psybuzz): move to some compatibility file.
Expand Down Expand Up @@ -248,6 +264,14 @@ export function migrateLegacyURLScheme() {
}
}
}

// Remove hash params that are now managed by Angular query params or
// localStorage. This prevents the URL from accumulating stale params
// that were written by legacy Polymer components.
for (const key of LEGACY_HASH_PARAMS_TO_REMOVE) {
delete items[key];
}

writeComponent(dictToComponent(items));
updateUrlDict(items);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import '../../../components/tf_runs_selector/tf-runs-selector';
import {
getBooleanInitializer,
getBooleanObserver,
getNumberInitializer,
getNumberObserver,
} from '../../../components/tf_storage/storage';
import '../../../components/tf_utils/utils';
import '../../scalar/tf_scalar_dashboard/tf-smoothing-input';
Expand Down Expand Up @@ -272,11 +270,8 @@ writer.add_summary(layout_summary)
@property({
type: Number,
notify: true,
observer: '_smoothingWeightObserver',
})
_smoothingWeight: number = getNumberInitializer('_smoothingWeight', {
defaultValue: 0.6,
}).call(this);
_smoothingWeight: number = 0.6;

@property({
type: Boolean,
Expand Down Expand Up @@ -362,9 +357,8 @@ writer.add_summary(layout_summary)
useLocalStorage: true,
});

_smoothingWeightObserver = getNumberObserver('_smoothingWeight', {
defaultValue: 0.6,
});
// Smoothing weight is no longer persisted to the URL hash.
// It is managed via Angular query params ('smoothing').

_ignoreYOutliersObserver = getBooleanObserver('_ignoreYOutliers', {
defaultValue: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,8 @@ class TfScalarDashboard extends LegacyElementMixin(ArrayUpdateHelper) {
@property({
type: Number,
notify: true,
observer: '_smoothingWeightObserver',
})
_smoothingWeight: number = tf_storage
.getNumberInitializer('_smoothingWeight', {
defaultValue: 0.6,
})
.call(this);
_smoothingWeight: number = 0.6;

@property({
type: Boolean,
Expand Down Expand Up @@ -283,9 +278,8 @@ class TfScalarDashboard extends LegacyElementMixin(ArrayUpdateHelper) {
{defaultValue: false, useLocalStorage: true}
);

_smoothingWeightObserver = tf_storage.getNumberObserver('_smoothingWeight', {
defaultValue: 0.6,
});
// Smoothing weight is no longer persisted to the URL hash.
// It is managed via Angular query params ('smoothing').

_ignoreYOutliersObserver = tf_storage.getBooleanObserver('_ignoreYOutliers', {
defaultValue: true,
Expand Down