Skip to content

Commit

Permalink
SOF-7123: set default data correctly for atomicSpecies
Browse files Browse the repository at this point in the history
  • Loading branch information
pranabdas committed Dec 1, 2023
1 parent 12535bf commit 37be003
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/context/providers/HubbardUContextProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ export class HubbardUContextProvider extends mix(JSONSchemaFormDataProvider).wit
}

get defaultData() {
return [{ ...defaultHubbardConfig, atomicSpecies: this.uniqueElements }];
return [
{
...defaultHubbardConfig,
atomicSpecies: this.uniqueElements?.length > 0 ? this.uniqueElements[0] : "",
},
];
}

get uiSchemaStyled() {
Expand Down
8 changes: 7 additions & 1 deletion src/context/providers/HubbardVContextProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ const defaultHubbardConfig = {

export class HubbardVContextProvider extends HubbardUContextProvider {
get defaultData() {
return [{ ...defaultHubbardConfig, atomicSpecies2: this.uniqueElements }];
return [
{
...defaultHubbardConfig,
atomicSpecies: this.uniqueElements?.length > 0 ? this.uniqueElements[0] : "",
atomicSpecies2: this.uniqueElements?.length > 0 ? this.uniqueElements[0] : "",
},
];
}

get uiSchemaStyled() {
Expand Down

0 comments on commit 37be003

Please sign in to comment.