Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding more null pointer checks for tgSelect, making annotation start… #30

Merged
merged 1 commit into from
Sep 18, 2023
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
4 changes: 2 additions & 2 deletions packages/sequence-utils/src/tidyUpAnnotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function coerceLocation({
" and set to size: " +
size
); //setting it to 0 internally, but users will see it as 1
location.start = size - (isProtein ? 3 : 1);
location.start = Math.max(0, size - (isProtein ? 3 : 1));
}
if (
location.end < 0 ||
Expand All @@ -172,7 +172,7 @@ function coerceLocation({
" and set to seq size: " +
size
); //setting it to 0 internally, but users will see it as 1
location.end = size - 1;
location.end = Math.max(0, size - 1);
}
if (location.start > location.end && circular === false) {
messages.push(
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/src/FormComponents/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ export const renderReactSelect = props => {
}
} else if (Array.isArray(value)) {
valueToUse = value.map(val => {
if (val.userCreated) {
if (val?.userCreated) {
return {
label: val.value,
value: val
Expand All @@ -719,10 +719,10 @@ export const renderReactSelect = props => {
let valToPass;
if (Array.isArray(valOrVals)) {
valToPass = valOrVals.map(function (val) {
if (val.userCreated) {
if (val?.userCreated) {
return val;
}
return val.value;
return val?.value;
});
} else if (valOrVals) {
if (valOrVals.userCreated) {
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/TgSelect/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class TgSelect extends React.Component {
) {
const topLevelId = item.value.split(":")[0];
valArray = valArray.filter(val => {
if (val.value && val.value.includes && val.value.includes(":")) {
if (val?.value && val.value.includes && val.value.includes(":")) {
const valId = val.value.split(":")[0];
if (valId === topLevelId) {
return false;
Expand Down Expand Up @@ -187,7 +187,7 @@ class TgSelect extends React.Component {
getTagProps = label => {
const { multi, value = [], disabled: _disabled } = this.props;
const val = Array.isArray(value) ? value : [value];
const matchingVal = val.find(op => op.label === label);
const matchingVal = val.find(op => op?.label === label);
const disabled = _disabled || (matchingVal && matchingVal.disabled);
const className = matchingVal && matchingVal.className;

Expand Down