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

timeline feed: render mathematical content in the request comments #403

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

anikachurilova
Copy link
Member

componentDidUpdate(prevProps) {
const { timeline } = this.props;

if (!_.isEqual(prevProps.timeline, timeline) && timeline?.hits?.total > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

While comparing timeline looks correct, it might be quite expensive... is there any other field, in the timeline object, that tell us that something changed?
I would also change the order of the conditions for performance:
timeline?.hits?.total > 0 && ...

Copy link
Contributor

@jrcastro2 jrcastro2 left a comment

Choose a reason for hiding this comment

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

Reviewed with @sakshamarora1 LGTU! 🚀

@kpsherva kpsherva merged commit a5771b3 into inveniosoftware:master Sep 17, 2024
2 checks passed
const hasComments = timeline?.hits?.total > 0;
const hasNewComments = prevProps.timeline?.hits?.total !== timeline?.hits?.total;
if (hasComments && hasNewComments) {
window.MathJax?.typeset();
Copy link
Contributor

Choose a reason for hiding this comment

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

missing mathjax as a requirement, how do we know this module has it in the window namespace?

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.

LaTeX rendering
4 participants