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

Fix some minor js issues #2184

Draft
wants to merge 17 commits into
base: update-bootstrap-ui-library
Choose a base branch
from

Conversation

jhmegorei
Copy link
Collaborator

I clicked through the app and noted a lot of small JS errors in development mode (mostly PropType related).

This PR fixes them as good as possible.

Copy link
Collaborator

@maiwald maiwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

updatedLiterature.refs = { citation, bibtex: citation.format('bibtex'), bibliography: json.format('bibliography') };

return ({ literature: updatedLiterature });
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this modifies the prevState.literature object. This may not cause any issues but I'd prefer creating a new object, as in {…prevState.literature, doi: doi, etc… }

updatedLiterature.refs = { citation, bibtex: citation.format('bibtex'), bibliography: json.format('bibliography') };

return ({ literature: updatedLiterature });
});
const { literature } = this.state;
this.handleLiteratureAdd(literature);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just looking at this, it seems odd that we are calling handleLiteratureAdd with the current literature object, that has not been affected by the changes in setState above.

The value is internally converted to a numeral anyway, so we can be lenient in accepting data.
Additionally, the component was called with a no longer existing property, which I removed as well.
…e object, not a JS Object

This caused Proptype Errors in AddButton and Citation
…onent

The original issue was just that the ToggleButton was situated in the Tab Button, which throws an error, because you are not allowed
to nest a <button> within a <button>.

Then it occurred to me, that this was the only instance where this button is used and that it's usage (namely toggling reaction scheme between default and gaseous)
was not very clear until you hover over the button and read the tooltip.

Therefore I replaced it by a regular bootstrap buttongroup we also use in other places. This way, the toggling functionality becomes clear directly,
as both buttons are displayed at the same time. So no more hover necessary. Additionally, the buttons use a global utility component for easier styling
of toggle buttons throughout the app.
The render function sets a default, so the prop is definitely not required
Copy link

LCOV of commit 0866fd8 during Continuous Integration #3996

Summary coverage rate:
  lines......: 65.5% (14010 of 21400 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate: n/a

Copy link

LCOV of commit b39ed11 during Continuous Integration #4001

Summary coverage rate:
  lines......: 65.5% (14011 of 21399 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate: n/a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants