timeseries: fix setting reset causing weird behavior#5458
Merged
Conversation
PR tensorflow#5030 divided up the default setting from overrides and, in selector, we have mixed two values in selectors to make a concrete settings value. When reset, overriden values were set to `undefined` and caused the settings to be very wrong. ```ts // This resolves to {a: undefined} {...{a: 1}, ...{a: undefined}} ``` Object spread (or `assign`) does not skip a property whose value is `undefined` and causes settingOverride with undefined value to take precedence over the default value which, in the end, resolves the image brightness/contrast values to `undefined` unlike what the types indicated. In the end, this is a fault of the type system since the interface is defined as `Partial<>` and a value should really not have `undefined` value. To illustrate, ```ts interface Foo { bar: number; } // Legal; `bar` property may not exist const foo2: Partial<Foo> = { }; // Legal; `bar` is defined as `number` but here, it is `undefined` // yet it is legal. const foo3: Partial<Foo> = { bar: undefined }; ``` TypeScript 4.4 has a way to property guard against `undefined` value in a `Partial<>` type, `"exactOptionalPropertyTypes"` but TensorBoard app currently violates the type definition so we will enable the tsconfig in a subsequent changes.
bmd3k
approved these changes
Dec 14, 2021
yatbear
pushed a commit
to yatbear/tensorboard
that referenced
this pull request
Mar 27, 2023
PR tensorflow#5030 divided up the default setting from overrides and, in selector, we have mixed two values in selectors to make a concrete settings value. When reset, overriden values were set to `undefined` and caused the settings to be very wrong. ```ts // This resolves to {a: undefined} {...{a: 1}, ...{a: undefined}} ``` Object spread (or `assign`) does not skip a property whose value is `undefined` and causes settingOverride with undefined value to take precedence over the default value which, in the end, resolves the image brightness/contrast values to `undefined` unlike what the types indicated. In the end, this is a fault of the type system since the interface is defined as `Partial<>` and a value should really not have `undefined` value. To illustrate, ```ts interface Foo { bar: number; } // Legal; `bar` property may not exist const foo2: Partial<Foo> = { }; // Legal; `bar` is defined as `number` but here, it is `undefined` // yet it is legal. const foo3: Partial<Foo> = { bar: undefined }; ``` TypeScript 4.4 has a way to property guard against `undefined` value in a `Partial<>` type, `"exactOptionalPropertyTypes"` but TensorBoard app currently violates the type definition so we will enable the tsconfig in a subsequent changes.
dna2github
pushed a commit
to dna2fork/tensorboard
that referenced
this pull request
May 1, 2023
PR tensorflow#5030 divided up the default setting from overrides and, in selector, we have mixed two values in selectors to make a concrete settings value. When reset, overriden values were set to `undefined` and caused the settings to be very wrong. ```ts // This resolves to {a: undefined} {...{a: 1}, ...{a: undefined}} ``` Object spread (or `assign`) does not skip a property whose value is `undefined` and causes settingOverride with undefined value to take precedence over the default value which, in the end, resolves the image brightness/contrast values to `undefined` unlike what the types indicated. In the end, this is a fault of the type system since the interface is defined as `Partial<>` and a value should really not have `undefined` value. To illustrate, ```ts interface Foo { bar: number; } // Legal; `bar` property may not exist const foo2: Partial<Foo> = { }; // Legal; `bar` is defined as `number` but here, it is `undefined` // yet it is legal. const foo3: Partial<Foo> = { bar: undefined }; ``` TypeScript 4.4 has a way to property guard against `undefined` value in a `Partial<>` type, `"exactOptionalPropertyTypes"` but TensorBoard app currently violates the type definition so we will enable the tsconfig in a subsequent changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #5030 divided up the default setting from overrides and, in selector,
we have mixed two values in selectors to make a concrete settings value.
When reset, overriden values were set to
undefinedand caused thesettings to be very wrong.
Object spread (or
assign) does not skip a property whose value isundefinedand causes settingOverride with undefined value to takeprecedence over the default value which, in the end, resolves the image
brightness/contrast values to
undefinedunlike what the typesindicated.
In the end, this is a fault of the type system since the interface is
defined as
Partial<>and a value should really not haveundefinedvalue. To illustrate,
TypeScript 4.4 has a way to property guard against
undefinedvalue ina
Partial<>type,"exactOptionalPropertyTypes"but TensorBoard appcurrently violates the type definition so we will enable the tsconfig in
a subsequent changes.