Skip to content

Commit

Permalink
Numeric fields with defaults that evaluate to False are considered a …
Browse files Browse the repository at this point in the history
…missing field. Buttons to add the example are therefore not rendered and an error message is displayed instead.

PiperOrigin-RevId: 573868488
  • Loading branch information
cpka145 authored and LIT team committed Oct 16, 2023
1 parent 8a3f366 commit e63b674
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lit_nlp/client/modules/datapoint_editor_module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,18 @@ export class DatapointEditorModule extends LitModule {

@computed
get missingFields(): string[] {
// Check only for initial values that are null or undefined for numeric
// values to allow for defaults that evaluate to false.
return this.appState.currentModelRequiredInputSpecKeys.filter(
key => !this.editedData.data[key]);
(key: string) => {
if (this.groupService.numericalFeatureNames.includes(key)) {
return this.editedData.data[key] === undefined ||
this.editedData.data[key] === null;
}
else {
return !this.editedData.data[key];
}
});
}

@computed
Expand Down

0 comments on commit e63b674

Please sign in to comment.