Skip to content

MathJax.Provider doesn't load MathJax when the first node is added after componentDidMount. #23

@frederikcreemers

Description

@frederikcreemers

MathJax.Provider calls this.load() only in componentDidMount and componentDidUpdate.
load() then loads Mathax if this.hasNodes is true, which in turn is set when a node calls the registerNode function it receives from the context. The hasNodes is stored on the Mathax.Provider instance itself, rather than the state, so setting it doesn't cause componentDidUpdate to be called, so at least one component needs to be registered before componentDidMount is called.

So I propose making hasNodes part of the state, and will submit a PR to do just that. Let me know if I'm misunderstanding anything.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions