We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 88f1ccb commit 960bf4eCopy full SHA for 960bf4e
lit_nlp/client/lib/types.ts
@@ -318,6 +318,10 @@ export function defaultValueByField(key: string, spec: Spec) {
318
const fieldSpec: LitType = spec[key];
319
// Explicitly check against undefined, as this value is often false-y if set.
320
if (fieldSpec.default !== undefined) {
321
+ if (fieldSpec instanceof CategoryLabel &&
322
+ fieldSpec.vocab && !fieldSpec.vocab.includes(fieldSpec.default)) {
323
+ return fieldSpec.vocab[0];
324
+ }
325
return fieldSpec.default;
326
}
327
// TODO(lit-dev): remove these and always use the spec default value.
0 commit comments